go icon indicating copy to clipboard operation
go copied to clipboard

A high-performance 100% compatible drop-in replacement of "encoding/json"

Results 188 go issues
Sort by recently updated
recently updated
newest added

## Description `"encoding/json"` behaves differently for certain inputs for `json.Number`. Specifically, `"encoding/json"` checks that `json.Number` is a valid number whereas jsoniter doesn't check anything. This should be either specified in...

> json = jsoniter.ConfigCompatibleWithStandardLibrary > json.Marshal() ``` github.com/json-iterator/go.(*structFieldEncoder).Encode(0xc0471f5b30, 0xc2f0060400, 0xc2ff36daa0) /root/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_struct_encoder.go:110 +0x78 github.com/json-iterator/go.(*structEncoder).Encode(0xc0471f5bc0, 0xc2f0060400, 0xc2ff36daa0) /root/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_struct_encoder.go:158 +0x3f4 github.com/json-iterator/go.(*OptionalEncoder).Encode(0xc15d5da750, 0xc2eb1d10a8, 0xc2ff36daa0) /root/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_optional.go:70 +0xf4 github.com/json-iterator/go.(*placeholderEncoder).Encode(0xc15d5da680, 0xc2eb1d10a8, 0xc2ff36daa0) /root/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:332 +0x47 github.com/json-iterator/go.(*structFieldEncoder).Encode(0xc047202810, 0xc2eb1d1080, 0xc2ff36daa0)...

I ran the parsing test cases from https://github.com/nst/JSONTestSuite against both `json.Valid()` and `jsoniter.Valid()`. There are several cases where they give differing results. This workaround adapted from what @JeckieLI provided in...

For example: ``` func TestSomething(t *testing.T) { valid := jsoniter.Valid([]byte("abc")) require.False(t, valid) } ``` returns _false_ and pass the test case, but ``` func TestSomething(t *testing.T) { valid := jsoniter.Valid([]byte("123abc"))...

Hello. I'm using version 1.1.7 and it crashes sometimes with mutex error. Here is crash log: ``` fatal error: sync: inconsistent mutex state goroutine 2058814 [running]: runtime.throw(0x102ec51, 0x1e) /usr/local/go/src/runtime/panic.go:774 +0x72...

> $ go version > go version go1.16.2 linux/arm64 > $ ./build.sh > + '[' '!' -d /tmp/build-golang/src/github.com/json-iterator ']' > ./build.sh > + '[' '!' -d /tmp/build-golang/src/github.com/json-iterator ']' > +...

是否考虑过,bool对string、int类型的兼容? 目前好像是不兼容的!!

There is no check for `null` in `ReadStringAsSlice` as for `ReadString`

This is to avoid allocations, also fixes tests still not working with go1.15. Signed-off-by: Cyril Tovena

```go api := jsoniter.Config{ DisallowUnknownFields: true, }.Froze() any := api.Get([]byte(`{"data":[{"a":1}]}`), "data") var data []struct{} any.ToVal(&data) if err := any.LastError(); err != nil { panic(err) } ``` 如代码所示,ToVal方法没有返回`error`,LastError()始终返回`nil`。 请问如何修复?