We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When decoding, it seems that the internal buffer stores the data without nested quotes, and its offsets seem to be reported for this buffer.
So the InputOffset() method will report the wrong offset compared to the original input and to encoding/json.
encoding/json
Example:
func TestDecode(t *testing.T) { dec := json.NewDecoder(bytes.NewReader([]byte(`{"test":"\""}`))) offset := dec.InputOffset() if offset != 0 { t.Errorf("expected 0, got %d", offset) } var v map[string]interface{} err := dec.Decode(&v) if err != nil { t.Errorf("unexpected error: %v", err) } if v["test"] != "\"" { t.Errorf("expected [\"a\",\"b\"], got %v", v["test"]) } offset = dec.InputOffset() if offset != 13 { t.Errorf("expected offset to be 13, got %d", offset) } }
When using encoding/json: passes
when using goccy/go-json: expected offset to be 13, got 12.
goccy/go-json
The discrepancy will get bigger the more nested quotes there are.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When decoding, it seems that the internal buffer stores the data without nested quotes, and its offsets seem to be reported for this buffer.
So the InputOffset() method will report the wrong offset compared to the original input and to
encoding/json
.Example:
When using
encoding/json
: passeswhen using
goccy/go-json
: expected offset to be 13, got 12.The discrepancy will get bigger the more nested quotes there are.
The text was updated successfully, but these errors were encountered: