Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

jsoniter.Any does not support float64 #317

@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