go
go copied to clipboard
A high-performance 100% compatible drop-in replacement of "encoding/json"
我用了 A 库 和 B 库,两者都设置了 RegisterTypeDecoderFunc,比如 ```go // A 库 jsoniter.RegisterTypeDecoderFunc("bool", func(ptr unsafe.Pointer, iter *jsoniter.Iterator) { switch iter.WhatIsNext() { case jsoniter.StringValue: var t bool v := strings.TrimSpace(iter.ReadString()) if v...
Hello, got an issue after deployment. My service restarted with a following panic: ``` fatal error: concurrent map writes goroutine 26280 [running]: runtime.throw({0x1284e53?, 0x7ff5ce6ddc48?}) \t/usr/local/go/src/runtime/panic.go:992 +0x71 fp=0xc12c758088 sp=0xc12c758058 pc=0x4362b1 runtime.mapassign(0x10ac900?,...
Expected result: when attempting to serialize invalid raw json, when `ValidateJsonRawMessage = true`, an error should be returned. Actual result: no error is returned. Instead, the invalid raw json is...
right usage ``` m := make(map[string]interface{}) m["json.maxItemsComputed"] = 8000 m["C_Cpp.formatting"] = "Disabled" m["workbench.iconTheme"] = "vscode-icons-mac" m["C_Cpp.autocomplete"] = "Disabled" m["editor.folding"] = map[string]interface{}{ "ssss": 123, } s, _ := jsoniter.MarshalIndent(m, "", "...
  the same case 1MB or 10MB to encoder。
not support yet
Is it possible, when marshaling a struct, to add fields with keys set to the method's name and values corresponding to the result of niladic methods? An example: ```go type...
I may misunderstand the idea behind `iter.ReadStringAsSlice`. The [documentation](https://github.com/json-iterator/go/blob/e6b9536d3649bda3e8842bb7e4fab489d79a97ea/iter_str.go#L114-L116) states: > ReadStringAsSlice read string from iterator without copying into string form. The []byte can not be kept, as it will...
darwin/arm64 on Go 1.18. Using function to copy from one `*os.File` to another. ```go func prettyIter(w io.Writer, r io.Reader) error { json := jsoniter.ConfigCompatibleWithStandardLibrary d := json.NewDecoder(r) e := json.NewEncoder(w)...
We've discovered an odd performance case in our use of jsoniter. In essence, jsoniter becomes very slow and outputs extremely long error messages when marshaling a slice of structs where...