Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsoniter.Any does not support float64 #317

Closed
TCBeliever opened this issue Oct 29, 2018 · 0 comments
Closed

jsoniter.Any does not support float64 #317

TCBeliever opened this issue Oct 29, 2018 · 0 comments

Comments

@TCBeliever
Copy link

TCBeliever commented Oct 29, 2018

https://play.golang.org/p/k8N1_YAYB__s

package main

import (
"log"
"github.com/json-iterator/go"
)

type TestStruct struct {
Tfloat jsoniter.Any
}

var (
jsonToTest = []byte("{"Tfloat":1.122e+250}")
)

func main() {
n := TestStruct{}
err := jsoniter.Unmarshal(jsonToTest, &n)

if err != nil {
	panic(err)
}

log.Println("Original:", n)

}

with large number the jsoniter.Any is broken
error message is like:
panic: main.TestStruct.Tfloat: strconv.ParseFloat: parsing "1.122e+250": value out of range

using interface{} is OK
json.RawMessage is not OK

@taowen taowen closed this as completed in d05f387 Nov 12, 2018
zhenzou pushed a commit to zhenzou/jsoniter that referenced this issue Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant