json-iterator / go

A high-performance 100% compatible drop-in replacement of "encoding/json"
http://jsoniter.com/migrate-from-go-std.html
MIT License
13.43k stars 1.03k forks source link

Valid() fails to validate plain numbers #520

Open silverwind opened 3 years ago

silverwind commented 3 years ago

Plain numbers are valid JSON but they are being rejected. It works with the standard library:

fmt.Println(jsoniter.Valid([]byte("1"))) // false
fmt.Println(jsoniter.ConfigCompatibleWithStandardLibrary.Valid([]byte("1"))) // false
fmt.Println(json.Valid([]byte("1"))) // true