Skip to content

jsoniter.Any does not support float64 #317

Closed
@TCBeliever

Description

@TCBeliever

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions