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

Overview

Sourcegraph GoDoc Build Status codecov rcard License Gitter chat

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

You can also use thrift like JSON using thrift-iterator

Benchmark

benchmark

Source code: https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go

Raw Result (easyjson requires static code generation)

ns/op allocation bytes allocation times
std decode 35510 ns/op 1960 B/op 99 allocs/op
easyjson decode 8499 ns/op 160 B/op 4 allocs/op
jsoniter decode 5623 ns/op 160 B/op 3 allocs/op
std encode 2213 ns/op 712 B/op 5 allocs/op
easyjson encode 883 ns/op 576 B/op 3 allocs/op
jsoniter encode 837 ns/op 384 B/op 4 allocs/op

Always benchmark with your own workload. The result depends heavily on the data input.

Usage

100% compatibility with standard lib

Replace

import "encoding/json"
json.Marshal(&data)

with

import jsoniter "github.com/json-iterator/go"

var json = jsoniter.ConfigCompatibleWithStandardLibrary
json.Marshal(&data)

Replace

import "encoding/json"
json.Unmarshal(input, &data)

with

import jsoniter "github.com/json-iterator/go"

var json = jsoniter.ConfigCompatibleWithStandardLibrary
json.Unmarshal(input, &data)

More documentation

How to get

go get github.com/json-iterator/go

Contribution Welcomed !

Contributors

Report issue or pull request, or email [email protected], or Gitter chat

Issues
  • decode number to interface{} as int64 rather than float64

    decode number to interface{} as int64 rather than float64

    I have a case where I need to decode into an interface{} as an int64, rather than float64. Is there a way to request that? Ideally it would be automatic - if the encoded value is a whole number, use int64, else use float64.

    stdlib has decoder.UseNumber which is closer to what we need...

    opened by thockin 19
  • 数组解析貌似有bug吖~~

    数组解析貌似有bug吖~~

    {"Info":{"InfoHash":"YWIlITn0T6UDgTqr8B8OLgC+mkw=","InfoHashstr":"6162252139F44FA503813AABF01F0E2E00BE9A4C","AnnounceList":null,"Length":7355754008,"PieceSize":8388608,"PieceNum":877},"InfoHashstr":"6162252139F44FA503813AABF01F0E2E00BE9A4C","SectionNum":40,"PieceNum":880,"PieceSize":16384,"Finished":false,"SparseSize":104857600,"Bit":[{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":880,"EndIndex":-1,"EndMask":0,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}]}

    上面这段json, 外层的Bit数组一共有40个,解析时,到第17个数组就结束了,后续就跟着报错啦. 在ReadArray中看到是 case 'n' 返回false, 结束数组解析.

    opened by liuxp0827 12
  • 大量请求时,内存泄漏问题

    大量请求时,内存泄漏问题

    目前我有一个项目,每天晚上需要更新大量的数据约300W条数据。通过更新发现内存会越来越大。

    我写了个testing.更新100000条数据。最后内存的结果为: image

    随着更新的数据越来越多,github.com/json-iterator/go.(*Iterator).readStringSlowPath 占用的内存会越来越大。

    请帮忙看一下是什么原因?谢谢

    opened by ahlzhang 10
  • Using strings.Builder in golang v1.10 to reduce memory allocations

    Using strings.Builder in golang v1.10 to reduce memory allocations

    According issue #240 , there is no reason why we don't, so I've tried.

    And we are facing the real problems, the json.Unmarshal has been in our service's hot path. The Iterator.ReadString and Iterator.readStringSlowPath has been called multiple times per second. Any reasonable patch which could reduce the memory allocation will be valuable.

    I've tried to avoid to use any incompatible trick of Golang. So if there is any plan to support new features of golang v1.10, this PR should be helpful I think.

    opened by junchih 9
  • "found bad pointer in Go heap" when under load with large file

    Summary

    I'm getting an error from the garbage collector when I try json-iterator under load. I'm unmarshalling a large JSON file (2.7MB) repeatedly during a test into a regular struct. When the test is run with a long duration (=load), like -test.benchtime 10s, the test will fail while the minio server panics with the output below.

    I'm not sure where the problem is but I'd be very grateful for some assistance.

    Setup

    $ go version
    go version go1.7.6 linux/amd64
    $ uname -a
    Linux ... 4.10.0-24-generic #28-Ubuntu SMP Wed Jun 14 08:14:34 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
    

    The server has the jsoniter integration. It's in a PR (https://github.com/minio/minio/pull/4692). The integration is simple: https://github.com/brendanashworth/minio/commit/035bd53d12c1aa21b92cebbc7faf32f01ed91621. The JSON is retrieved and unmarshalled from multiple disks.

    Runtime panic

    runtime: pointer 0xc420a04000 to unallocated spanidx=0x502 span.base()=0xc4209e6000 span.limit=0xc420a06000 span.state=2
    runtime: found in object at *(0xc4221f0000+0x126b0)
    object=0xc4221f0000 k=0x62110f8 s.base()=0xc4221f0000 s.limit=0xc42227ba40 s.sizeclass=0 s.elemsize=573440
     *(object+0) = 0xc422366000
     *(object+8) = 0x6
     *(object+16) = 0xc422366006
     *(object+24) = 0x7
     *(object+32) = 0xc42182a000
     *(object+40) = 0x80
     *(object+48) = 0xc422366010
     *(object+56) = 0x6
     *(object+64) = 0xc422366016
     *(object+72) = 0x7
     *(object+80) = 0xc42182a080
     *(object+88) = 0x80
     *(object+96) = 0xc422366020
     *(object+104) = 0x6
     *(object+112) = 0xc422366026
     *(object+120) = 0x7
     *(object+128) = 0xc42182a200
     *(object+136) = 0x80
     *(object+144) = 0xc422366030
     *(object+152) = 0x6
     *(object+160) = 0xc422366036
     *(object+168) = 0x7
     *(object+176) = 0xc42182a280
     *(object+184) = 0x80
     *(object+192) = 0xc422366040
     *(object+200) = 0x6
     *(object+208) = 0xc422366046
     *(object+216) = 0x7
     *(object+224) = 0xc42182a300
     *(object+232) = 0x80
     *(object+240) = 0xc422366050
     *(object+248) = 0x6
     *(object+256) = 0xc422366056
     *(object+264) = 0x7
     *(object+272) = 0xc42182a380
     *(object+280) = 0x80
     *(object+288) = 0xc422366060
     *(object+296) = 0x6
     *(object+304) = 0xc422366066
     *(object+312) = 0x7
     *(object+320) = 0xc42182a400
     *(object+328) = 0x80
     *(object+336) = 0xc422366070
     *(object+344) = 0x6
     *(object+352) = 0xc422366076
     *(object+360) = 0x7
     *(object+368) = 0xc42182a480
     *(object+376) = 0x80
     *(object+384) = 0xc422366080
     *(object+392) = 0x6
     *(object+400) = 0xc422366086
     *(object+408) = 0x7
     *(object+416) = 0xc42182a500
     *(object+424) = 0x80
     *(object+432) = 0xc422366090
     *(object+440) = 0x7
     *(object+448) = 0xc422366097
     *(object+456) = 0x7
     *(object+464) = 0xc42182a580
     *(object+472) = 0x80
     *(object+480) = 0xc4223660a0
     *(object+488) = 0x7
     *(object+496) = 0xc4223660a7
     *(object+504) = 0x7
     *(object+512) = 0xc42182a600
     *(object+520) = 0x80
     *(object+528) = 0xc4223660b0
     *(object+536) = 0x7
     *(object+544) = 0xc4223660b7
     *(object+552) = 0x7
     *(object+560) = 0xc42182a680
     *(object+568) = 0x80
     *(object+576) = 0xc4223660c0
     *(object+584) = 0x7
     *(object+592) = 0xc4223660c7
     *(object+600) = 0x7
     *(object+608) = 0xc42182a700
     *(object+616) = 0x80
     *(object+624) = 0xc4223660d0
     *(object+632) = 0x7
     *(object+640) = 0xc4223660d7
     *(object+648) = 0x7
     *(object+656) = 0xc42182a780
     *(object+664) = 0x80
     *(object+672) = 0xc4223660e0
     *(object+680) = 0x7
     *(object+688) = 0xc4223660e7
     *(object+696) = 0x7
     *(object+704) = 0xc42182a800
     *(object+712) = 0x80
     *(object+720) = 0xc4223660f0
     *(object+728) = 0x7
     *(object+736) = 0xc4223660f7
     *(object+744) = 0x7
     *(object+752) = 0xc42182a880
     *(object+760) = 0x80
     *(object+768) = 0xc422366100
     *(object+776) = 0x7
     *(object+784) = 0xc422366107
     *(object+792) = 0x7
     *(object+800) = 0xc42182a900
     *(object+808) = 0x80
     *(object+816) = 0xc422366110
     *(object+824) = 0x7
     *(object+832) = 0xc422366117
     *(object+840) = 0x7
     *(object+848) = 0xc42182a980
     *(object+856) = 0x80
     *(object+864) = 0xc422366120
     *(object+872) = 0x7
     *(object+880) = 0xc422366127
     *(object+888) = 0x7
     *(object+896) = 0xc42182aa00
     *(object+904) = 0x80
     *(object+912) = 0xc422366130
     *(object+920) = 0x7
     *(object+928) = 0xc422366137
     *(object+936) = 0x7
     *(object+944) = 0xc42182aa80
     *(object+952) = 0x80
     *(object+960) = 0xc422366140
     *(object+968) = 0x7
     *(object+976) = 0xc422366147
     *(object+984) = 0x7
     *(object+992) = 0xc42182ab00
     *(object+1000) = 0x80
     *(object+1008) = 0xc422366150
     *(object+1016) = 0x7
     ...
     *(object+75320) = 0x9
     *(object+75328) = 0xc4204312f9
     *(object+75336) = 0x7
     *(object+75344) = 0xc4209dff00
     *(object+75352) = 0x80
     *(object+75360) = 0xc420431300
     *(object+75368) = 0x9
     *(object+75376) = 0xc420431309
     *(object+75384) = 0x7
     *(object+75392) = 0xc4209dff80
     *(object+75400) = 0x80
     *(object+75408) = 0xc420431310
     *(object+75416) = 0x9
     *(object+75424) = 0xc420431319
     *(object+75432) = 0x7
     *(object+75440) = 0xc420a04000 <==
     *(object+75448) = 0x80
     *(object+75456) = 0xc420431320
     *(object+75464) = 0x9
     *(object+75472) = 0xc420431329
     *(object+75480) = 0x7
     *(object+75488) = 0xc420a04080
     *(object+75496) = 0x80
     *(object+75504) = 0xc420431330
     *(object+75512) = 0x9
     *(object+75520) = 0xc420431339
     *(object+75528) = 0x7
     *(object+75536) = 0xc420a04100
     *(object+75544) = 0x80
     *(object+75552) = 0xc420431340
     *(object+75560) = 0x9
     ...
    fatal error: found bad pointer in Go heap (incorrect use of unsafe or cgo?)
    
    goroutine 29 [running]:
    runtime.throw(0x105a5d5, 0x3e)
    	/root/go/src/runtime/panic.go:566 +0x95 fp=0xc420049e38 sp=0xc420049e18
    runtime.heapBitsForObject(0xc420a04000, 0xc4221f0000, 0x126b0, 0xc41ffde767, 0xc400000002, 0x7f47268e8dd0, 0xc420020728, 0x131)
    	/root/go/src/runtime/mbitmap.go:429 +0x2ba fp=0xc420049e90 sp=0xc420049e38
    runtime.scanobject(0xc4221f0000, 0xc420020728)
    	/root/go/src/runtime/mgcmark.go:1175 +0x170 fp=0xc420049f10 sp=0xc420049e90
    runtime.gcDrain(0xc420020728, 0x6)
    	/root/go/src/runtime/mgcmark.go:999 +0x15c fp=0xc420049f48 sp=0xc420049f10
    runtime.gcBgMarkWorker(0xc42001f500)
    	/root/go/src/runtime/mgc.go:1458 +0x4ad fp=0xc420049fb8 sp=0xc420049f48
    runtime.goexit()
    	/root/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420049fc0 sp=0xc420049fb8
    created by runtime.gcBgMarkStartWorkers
    	/root/go/src/runtime/mgc.go:1349 +0x98
    
    goroutine 1 [select, 12 minutes]:
    github.com/minio/minio/cmd.handleSignals()
    	/root/gopath/src/github.com/minio/minio/cmd/signals.go:53 +0x607
    github.com/minio/minio/cmd.serverMain(0xc42030e160)
    	/root/gopath/src/github.com/minio/minio/cmd/server-main.go:223 +0x807
    github.com/minio/minio/vendor/github.com/minio/cli.HandleAction(0xe6e9c0, 0x10cd1d0, 0xc42030e160, 0xc4201a7900, 0x0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/minio/cli/app.go:499 +0x7c
    github.com/minio/minio/vendor/github.com/minio/cli.Command.Run(0x10251f0, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x103f2fa, 0x1c, 0x0, ...)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/minio/cli/command.go:214 +0xb9a
    github.com/minio/minio/vendor/github.com/minio/cli.(*App).Run(0xc42019fba0, 0xc42000a0c0, 0x6, 0x6, 0x0, 0x0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/minio/cli/app.go:260 +0x816
    github.com/minio/minio/cmd.Main(0xc42000a0c0, 0x6, 0x6)
    	/root/gopath/src/github.com/minio/minio/cmd/main.go:145 +0x8d
    main.main()
    	/root/gopath/src/github.com/minio/minio/main.go:68 +0x7b
    
    goroutine 17 [syscall, 12 minutes]:
    os/signal.signal_recv(0xc42004bfa8)
    	/root/go/src/runtime/sigqueue.go:116 +0x157
    os/signal.loop()
    	/root/go/src/os/signal/signal_unix.go:22 +0x22
    created by os/signal.init.1
    	/root/go/src/os/signal/signal_unix.go:28 +0x41
    
    goroutine 66 [IO wait]:
    net.runtime_pollWait(0x7f47268e7948, 0x72, 0x0)
    	/root/go/src/runtime/netpoll.go:160 +0x59
    net.(*pollDesc).wait(0xc4201a8290, 0x72, 0xc42004de78, 0xc4200141b0)
    	/root/go/src/net/fd_poll_runtime.go:73 +0x38
    net.(*pollDesc).waitRead(0xc4201a8290, 0x15bf440, 0xc4200141b0)
    	/root/go/src/net/fd_poll_runtime.go:78 +0x34
    net.(*netFD).accept(0xc4201a8230, 0x0, 0x15bc300, 0xc42215b5e0)
    	/root/go/src/net/fd_unix.go:419 +0x238
    net.(*TCPListener).accept(0xc42018a018, 0x433deb, 0xc42004df28, 0x914838)
    	/root/go/src/net/tcpsock_posix.go:132 +0x2e
    net.(*TCPListener).AcceptTCP(0xc42018a018, 0xc4201ea0c0, 0xc42018a030, 0xc420576060)
    	/root/go/src/net/tcpsock.go:209 +0x49
    github.com/minio/minio/pkg/http.(*httpListener).start.func3(0xc42018a018, 0xc420576060)
    	/root/gopath/src/github.com/minio/minio/pkg/http/listener.go:197 +0x41
    created by github.com/minio/minio/pkg/http.(*httpListener).start
    	/root/gopath/src/github.com/minio/minio/pkg/http/listener.go:211 +0x1cd
    
    goroutine 9 [select, 12 minutes, locked to thread]:
    runtime.gopark(0x10cf070, 0x0, 0x10251e4, 0x6, 0x18, 0x2)
    	/root/go/src/runtime/proc.go:259 +0x13a
    runtime.selectgoImpl(0xc420496730, 0x0, 0x18)
    	/root/go/src/runtime/select.go:423 +0x1235
    runtime.selectgo(0xc420496730)
    	/root/go/src/runtime/select.go:238 +0x1c
    runtime.ensureSigM.func1()
    	/root/go/src/runtime/signal1_unix.go:304 +0x2f3
    runtime.goexit()
    	/root/go/src/runtime/asm_amd64.s:2086 +0x1
    
    goroutine 8 [chan receive]:
    github.com/minio/minio/pkg/http.(*httpListener).Accept(0xc4201a82a0, 0x10ce9e0, 0xc420aaa280, 0x15c6c40, 0xc420450390)
    	/root/gopath/src/github.com/minio/minio/pkg/http/listener.go:217 +0x6d
    net/http.(*Server).Serve(0xc420315860, 0x15c3400, 0xc4201a82a0, 0x0, 0x0)
    	/root/go/src/net/http/server.go:2273 +0x1ce
    github.com/minio/minio/pkg/http.(*Server).Start(0xc420315860, 0x0, 0x0)
    	/root/gopath/src/github.com/minio/minio/pkg/http/server.go:116 +0x1cc
    github.com/minio/minio/cmd.serverMain.func1()
    	/root/gopath/src/github.com/minio/minio/cmd/server-main.go:199 +0x2d
    created by github.com/minio/minio/cmd.serverMain
    	/root/gopath/src/github.com/minio/minio/cmd/server-main.go:200 +0x62c
    
    goroutine 15 [select, 12 minutes]:
    github.com/minio/minio/pkg/objcache.(*Cache).StartGC.func1(0xc42069e060)
    	/root/gopath/src/github.com/minio/minio/pkg/objcache/objcache.go:295 +0x133
    created by github.com/minio/minio/pkg/objcache.(*Cache).StartGC
    	/root/gopath/src/github.com/minio/minio/pkg/objcache/objcache.go:304 +0x3f
    
    goroutine 84 [select, 12 minutes]:
    github.com/minio/minio/pkg/objcache.(*Cache).StartGC.func1(0xc42000a180)
    	/root/gopath/src/github.com/minio/minio/pkg/objcache/objcache.go:295 +0x133
    created by github.com/minio/minio/pkg/objcache.(*Cache).StartGC
    	/root/gopath/src/github.com/minio/minio/pkg/objcache/objcache.go:304 +0x3f
    
    goroutine 1243 [GC assist wait]:
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*Iterator).ReadString(0xc4204c2070, 0xc4204c2070, 0x552)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_iter_string.go:15 +0x1ce
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*stringCodec).Decode(0x187aeb8, 0xc4207dff38, 0xc4204c2070)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_native.go:15 +0x2b
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*structFieldDecoder).Decode(0xc420458b40, 0xc4207dff30, 0xc4204c2070)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go:911 +0x5c
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*fourFieldsStructDecoder).Decode(0xc42045c0a0, 0xc4207dff30, 0xc4204c2070)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go:577 +0x2aa
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).doDecode.func1(0xc4204c2070, 0xe5ad2c)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:101 +0xa1
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*Iterator).ReadArrayCB(0xc4204c2070, 0xc42267d830, 0xe5ad20)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_iter_array.go:39 +0xae
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).doDecode(0xc4204503c0, 0xc4200924c8, 0xc4204c2070)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:104 +0xe7
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).Decode(0xc4204503c0, 0xc4200924c8, 0xc4204c2070)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:82 +0x49
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*structFieldDecoder).Decode(0xc420459440, 0xc420092410, 0xc4204c2070)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go:911 +0x5c
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sevenFieldsStructDecoder).Decode(0xc420198600, 0xc420092410, 0xc4204c2070)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go:705 +0x3a7
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*Iterator).ReadVal(0xc4204c2070, 0xf09740, 0xc420092410)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect.go:216 +0xea
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*frozenConfig).Unmarshal(0xc4201a6360, 0xc422e00000, 0x299cbb, 0x299ebb, 0xf09740, 0xc420092410, 0x0, 0x0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_config.go:283 +0x1ab
    github.com/minio/minio/vendor/github.com/json-iterator/go.Unmarshal(0xc422e00000, 0x299cbb, 0x299ebb, 0xf09740, 0xc420092410, 0x1d, 0xc4217ac010)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_adapter.go:16 +0x67
    github.com/minio/minio/cmd.xlMetaV1UnmarshalJSON(0xc422e00000, 0x299cbb, 0x299ebb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:127 +0xae
    github.com/minio/minio/cmd.readXLMeta(0x15ccd80, 0xc420450810, 0xc4207cfc65, 0x9, 0xc4207cfc6f, 0x3, 0x0, 0x0, 0x0, 0x0, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:151 +0x1a7
    github.com/minio/minio/cmd.readAllXLMetadata.func1(0xc420644ac0, 0xc4203ed880, 0x4, 0x4, 0xc4207cfc65, 0x9, 0xc4207cfc6f, 0x3, 0xc420468c80, 0x4, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:181 +0xb1
    created by github.com/minio/minio/cmd.readAllXLMetadata
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:186 +0x2af
    
    goroutine 1241 [GC assist wait]:
    reflect.unsafe_NewArray(0xf67f40, 0x200, 0xf67f40)
    	/root/go/src/runtime/malloc.go:803 +0x35
    reflect.MakeSlice(0x15d00c0, 0xe5ad20, 0x101, 0x200, 0xe5ad20, 0xc4203e7a80, 0x97)
    	/root/go/src/reflect/value.go:2043 +0xe5
    github.com/minio/minio/vendor/github.com/json-iterator/go.growOne(0xc4203143f8, 0x15d00c0, 0xe5ad20, 0x15d00c0, 0xf67f40)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:127 +0x8a
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).doDecode.func1(0xc420454000, 0xc42031432c)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:100 +0x68
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*Iterator).ReadArrayCB(0xc420454000, 0xc420685830, 0xe5ad20)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_iter_array.go:39 +0xae
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).doDecode(0xc4204503c0, 0xc4203143f8, 0xc420454000)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:104 +0xe7
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).Decode(0xc4204503c0, 0xc4203143f8, 0xc420454000)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:82 +0x49
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*structFieldDecoder).Decode(0xc420459440, 0xc420314340, 0xc420454000)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go:911 +0x5c
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sevenFieldsStructDecoder).Decode(0xc420198600, 0xc420314340, 0xc420454000)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go:705 +0x3a7
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*Iterator).ReadVal(0xc420454000, 0xf09740, 0xc420314340)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect.go:216 +0xea
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*frozenConfig).Unmarshal(0xc4201a6360, 0xc42184c000, 0x299cbb, 0x299ebb, 0xf09740, 0xc420314340, 0x0, 0x0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_config.go:283 +0x1ab
    github.com/minio/minio/vendor/github.com/json-iterator/go.Unmarshal(0xc42184c000, 0x299cbb, 0x299ebb, 0xf09740, 0xc420314340, 0x1d, 0xc4217b0000)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_adapter.go:16 +0x67
    github.com/minio/minio/cmd.xlMetaV1UnmarshalJSON(0xc42184c000, 0x299cbb, 0x299ebb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:127 +0xae
    github.com/minio/minio/cmd.readXLMeta(0x15ccd80, 0xc420450780, 0xc4207cfc65, 0x9, 0xc4207cfc6f, 0x3, 0x0, 0x0, 0x0, 0x0, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:151 +0x1a7
    github.com/minio/minio/cmd.readAllXLMetadata.func1(0xc420644ac0, 0xc4203ed880, 0x4, 0x4, 0xc4207cfc65, 0x9, 0xc4207cfc6f, 0x3, 0xc420468c80, 0x4, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:181 +0xb1
    created by github.com/minio/minio/cmd.readAllXLMetadata
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:186 +0x2af
    
    goroutine 1242 [GC assist wait]:
    reflect.unsafe_NewArray(0xf67f40, 0x200, 0xf67f40)
    	/root/go/src/runtime/malloc.go:803 +0x35
    reflect.MakeSlice(0x15d00c0, 0xe5ad20, 0x101, 0x200, 0xe5ad20, 0xc4203f5a20, 0x97)
    	/root/go/src/reflect/value.go:2043 +0xe5
    github.com/minio/minio/vendor/github.com/json-iterator/go.growOne(0xc4201383f8, 0x15d00c0, 0xe5ad20, 0x15d00c0, 0xf67f40)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:127 +0x8a
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).doDecode.func1(0xc4200720e0, 0xc42013832c)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:100 +0x68
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*Iterator).ReadArrayCB(0xc4200720e0, 0xc420aa9830, 0xe5ad20)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_iter_array.go:39 +0xae
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).doDecode(0xc4204503c0, 0xc4201383f8, 0xc4200720e0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:104 +0xe7
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).Decode(0xc4204503c0, 0xc4201383f8, 0xc4200720e0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:82 +0x49
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*structFieldDecoder).Decode(0xc420459440, 0xc420138340, 0xc4200720e0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go:911 +0x5c
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sevenFieldsStructDecoder).Decode(0xc420198600, 0xc420138340, 0xc4200720e0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go:705 +0x3a7
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*Iterator).ReadVal(0xc4200720e0, 0xf09740, 0xc420138340)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect.go:216 +0xea
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*frozenConfig).Unmarshal(0xc4201a6360, 0xc42395e000, 0x299cbb, 0x299ebb, 0xf09740, 0xc420138340, 0x0, 0x0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_config.go:283 +0x1ab
    github.com/minio/minio/vendor/github.com/json-iterator/go.Unmarshal(0xc42395e000, 0x299cbb, 0x299ebb, 0xf09740, 0xc420138340, 0x1d, 0xc4217ae000)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_adapter.go:16 +0x67
    github.com/minio/minio/cmd.xlMetaV1UnmarshalJSON(0xc42395e000, 0x299cbb, 0x299ebb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:127 +0xae
    github.com/minio/minio/cmd.readXLMeta(0x15ccd80, 0xc4204507e0, 0xc4207cfc65, 0x9, 0xc4207cfc6f, 0x3, 0x0, 0x0, 0x0, 0x0, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:151 +0x1a7
    github.com/minio/minio/cmd.readAllXLMetadata.func1(0xc420644ac0, 0xc4203ed880, 0x4, 0x4, 0xc4207cfc65, 0x9, 0xc4207cfc6f, 0x3, 0xc420468c80, 0x4, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:181 +0xb1
    created by github.com/minio/minio/cmd.readAllXLMetadata
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:186 +0x2af
    
    goroutine 1240 [semacquire]:
    sync.runtime_Semacquire(0xc420644acc)
    	/root/go/src/runtime/sema.go:47 +0x30
    sync.(*WaitGroup).Wait(0xc420644ac0)
    	/root/go/src/sync/waitgroup.go:131 +0x97
    github.com/minio/minio/cmd.readAllXLMetadata(0xc420190680, 0x4, 0x4, 0xc4207cfc65, 0x9, 0xc4207cfc6f, 0x3, 0xc420290c60, 0x2, 0x2, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:190 +0x2ed
    github.com/minio/minio/cmd.xlObjects.GetObject(0xc42045a638, 0xc420190680, 0x4, 0x4, 0x2, 0x2, 0x2, 0x3, 0xc42044e580, 0xc42000a180, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-object.go:153 +0x144
    github.com/minio/minio/cmd.(*xlObjects).GetObject(0xc4205760c0, 0xc4207cfc65, 0x9, 0xc4207cfc6f, 0x3, 0x0, 0xc80000000, 0x15bd700, 0xc420468140, 0x1852c60, ...)
    	<autogenerated>:1052 +0xfa
    github.com/minio/minio/cmd.objectAPIHandlers.GetObjectHandler(0x10cd138, 0x15c33c0, 0xc42031a600, 0xc420130870)
    	/root/gopath/src/github.com/minio/minio/cmd/object-handlers.go:160 +0x606
    github.com/minio/minio/cmd.(objectAPIHandlers).GetObjectHandler-fm(0x15c33c0, 0xc42031a600, 0xc420130870)
    	/root/gopath/src/github.com/minio/minio/cmd/api-router.go:56 +0x4e
    net/http.HandlerFunc.ServeHTTP(0xc4204652b0, 0x15c33c0, 0xc42031a600, 0xc420130870)
    	/root/go/src/net/http/server.go:1726 +0x44
    github.com/minio/minio/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201e03c0, 0x15c33c0, 0xc42031a600, 0xc420130870)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/gorilla/mux/mux.go:107 +0x10d
    github.com/minio/minio/cmd.pathValidityHandler.ServeHTTP(0x15b8f00, 0xc4201e03c0, 0x15c33c0, 0xc42031a600, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/cmd/generic-handlers.go:470 +0x18b
    github.com/minio/minio/cmd.(*pathValidityHandler).ServeHTTP(0xc42044a2b0, 0x15c33c0, 0xc42031a600, 0xc4201305a0)
    	<autogenerated>:512 +0x79
    github.com/minio/minio/cmd.httpStatsHandler.ServeHTTP(0x15bd840, 0xc42044a2b0, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/cmd/generic-handlers.go:409 +0xcb
    github.com/minio/minio/cmd.(*httpStatsHandler).ServeHTTP(0xc42044a2c0, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	<autogenerated>:511 +0x79
    github.com/minio/minio/cmd.requestSizeLimitHandler.ServeHTTP(0x15bd780, 0xc42044a2c0, 0x404000000, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/cmd/generic-handlers.go:65 +0x100
    github.com/minio/minio/cmd.(*requestSizeLimitHandler).ServeHTTP(0xc420525380, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	<autogenerated>:503 +0x82
    github.com/minio/minio/cmd.crossDomainPolicy.ServeHTTP(0x15bd8c0, 0xc420525380, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/cmd/crossdomain-xml-handler.go:51 +0x65
    github.com/minio/minio/cmd.(*crossDomainPolicy).ServeHTTP(0xc42044a2d0, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	<autogenerated>:347 +0x79
    github.com/minio/minio/cmd.redirectHandler.ServeHTTP(0x15bd6c0, 0xc42044a2d0, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/cmd/generic-handlers.go:131 +0xc0
    github.com/minio/minio/cmd.(*redirectHandler).ServeHTTP(0xc42044a2e0, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	<autogenerated>:504 +0x79
    github.com/minio/minio/cmd.minioPrivateBucketHandler.ServeHTTP(0x15bd880, 0xc42044a2e0, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/cmd/generic-handlers.go:177 +0x90
    github.com/minio/minio/cmd.(*minioPrivateBucketHandler).ServeHTTP(0xc42044a2f0, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	<autogenerated>:506 +0x79
    github.com/minio/minio/cmd.cacheControlHandler.ServeHTTP(0x15bd800, 0xc42044a2f0, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/cmd/generic-handlers.go:158 +0x60
    github.com/minio/minio/cmd.(*cacheControlHandler).ServeHTTP(0xc42044a300, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	<autogenerated>:505 +0x79
    github.com/minio/minio/cmd.timeValidityHandler.ServeHTTP(0x15bd680, 0xc42044a300, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/cmd/generic-handlers.go:247 +0x1e9
    github.com/minio/minio/cmd.(*timeValidityHandler).ServeHTTP(0xc42044a310, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	<autogenerated>:507 +0x79
    github.com/minio/minio/vendor/github.com/rs/cors.(*Cors).Handler.func1(0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/rs/cors/cors.go:190 +0xe9
    net/http.HandlerFunc.ServeHTTP(0xc420525420, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/go/src/net/http/server.go:1726 +0x44
    github.com/minio/minio/cmd.resourceHandler.ServeHTTP(0x15be900, 0xc420525420, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/cmd/generic-handlers.go:360 +0xa2
    github.com/minio/minio/cmd.(*resourceHandler).ServeHTTP(0xc42044a390, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	<autogenerated>:508 +0x79
    github.com/minio/minio/cmd.authHandler.ServeHTTP(0x15bd900, 0xc42044a390, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/cmd/auth-handler.go:229 +0x157
    github.com/minio/minio/cmd.(*authHandler).ServeHTTP(0xc42044a3b0, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	<autogenerated>:288 +0x79
    github.com/minio/minio/pkg/http.(*Server).Start.func1(0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/gopath/src/github.com/minio/minio/pkg/http/server.go:107 +0x108
    net/http.HandlerFunc.ServeHTTP(0xc4201ea100, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/go/src/net/http/server.go:1726 +0x44
    net/http.serverHandler.ServeHTTP(0xc420315860, 0x15c5bc0, 0xc420138270, 0xc4201305a0)
    	/root/go/src/net/http/server.go:2202 +0x7d
    net/http.(*conn).serve(0xc420aaa280, 0x15c6b80, 0xc420469bc0)
    	/root/go/src/net/http/server.go:1579 +0x4b7
    created by net/http.(*Server).Serve
    	/root/go/src/net/http/server.go:2293 +0x44d
    
    goroutine 1244 [GC assist wait]:
    reflect.unsafe_NewArray(0xf67f40, 0xf42, 0xf67f40)
    	/root/go/src/runtime/malloc.go:803 +0x35
    reflect.MakeSlice(0x15d00c0, 0xe5ad20, 0xc36, 0xf42, 0xe5ad20, 0xc420447460, 0x97)
    	/root/go/src/reflect/value.go:2043 +0xe5
    github.com/minio/minio/vendor/github.com/json-iterator/go.growOne(0xc4218324c8, 0x15d00c0, 0xe5ad20, 0x15d00c0, 0xf67f40)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:127 +0x8a
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).doDecode.func1(0xc420072a80, 0xe5ad2c)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:100 +0x68
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*Iterator).ReadArrayCB(0xc420072a80, 0xc422681830, 0xe5ad20)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_iter_array.go:39 +0xae
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).doDecode(0xc4204503c0, 0xc4218324c8, 0xc420072a80)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:104 +0xe7
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sliceDecoder).Decode(0xc4204503c0, 0xc4218324c8, 0xc420072a80)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_slice.go:82 +0x49
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*structFieldDecoder).Decode(0xc420459440, 0xc421832410, 0xc420072a80)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go:911 +0x5c
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*sevenFieldsStructDecoder).Decode(0xc420198600, 0xc421832410, 0xc420072a80)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go:705 +0x3a7
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*Iterator).ReadVal(0xc420072a80, 0xf09740, 0xc421832410)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_reflect.go:216 +0xea
    github.com/minio/minio/vendor/github.com/json-iterator/go.(*frozenConfig).Unmarshal(0xc4201a6360, 0xc423bf8000, 0x299cbb, 0x299ebb, 0xf09740, 0xc421832410, 0x0, 0x0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_config.go:283 +0x1ab
    github.com/minio/minio/vendor/github.com/json-iterator/go.Unmarshal(0xc423bf8000, 0x299cbb, 0x299ebb, 0xf09740, 0xc421832410, 0x1d, 0xc420644ae0)
    	/root/gopath/src/github.com/minio/minio/vendor/github.com/json-iterator/go/feature_adapter.go:16 +0x67
    github.com/minio/minio/cmd.xlMetaV1UnmarshalJSON(0xc423bf8000, 0x299cbb, 0x299ebb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:127 +0xae
    github.com/minio/minio/cmd.readXLMeta(0x15ccd80, 0xc420450840, 0xc4207cfc65, 0x9, 0xc4207cfc6f, 0x3, 0x0, 0x0, 0x0, 0x0, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:151 +0x1a7
    github.com/minio/minio/cmd.readAllXLMetadata.func1(0xc420644ac0, 0xc4203ed880, 0x4, 0x4, 0xc4207cfc65, 0x9, 0xc4207cfc6f, 0x3, 0xc420468c80, 0x4, ...)
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:181 +0xb1
    created by github.com/minio/minio/cmd.readAllXLMetadata
    	/root/gopath/src/github.com/minio/minio/cmd/xl-v1-utils.go:186 +0x2af
    
    opened by brendanashworth 9
  • Don't marshal empty byte or uint8 slice as null

    Don't marshal empty byte or uint8 slice as null

    Fixes https://github.com/json-iterator/go/issues/272

    []byte or []uint8 are encoded as base-64 encoded strings. So, only nil slices of these types should get marshalled as null, and non-nil empty slices should get marshalled as "".

    This restores compatibility with the standard library.

    I verified that this patch works locally. Even though tests for these exist in https://github.com/json-iterator/go/blob/master/type_tests/slice_test.go, I couldn't reproduce a case where the test case was fuzzed to an empty []byte or []uint8 slice... :confused:

    /cc @taowen @thockin fyi @liggitt @dims @neolit123

    opened by nikhita 7
  • Fix case sensitivity

    Fix case sensitivity

    Fixes https://github.com/kubernetes/kubernetes/issues/64612#issuecomment-396097020 Follow-up for https://github.com/json-iterator/go/pull/282

    Also see https://github.com/json-iterator/go/pull/282/files#r194283181

    opened by nikhita 7
  • marshalled results not sorted same as stdlib

    marshalled results not sorted same as stdlib

    	json_test.go:29: marshal expected:
    		    {
    		    >  "-1538202063": 0.3634222946643717,
    		    >  "1223101607": 0.16867633434109314,
    		    >  "576443938": 0.020297602318735935
    		    }
    		got:
    		    {
    		    >  "576443938": 0.020297602318735935,
    		    >  "1223101607": 0.16867633434109314,
    		    >  "-1538202063": 0.3634222946643717
    		    }
    

    This is sort of tedious, but being exactly compatible has some value, right?

    opened by thockin 7
  • duplicate keys in json

    duplicate keys in json

    when I tried to parse the json from valve's web api, there are some duplicate keys in it. encoding/json seems not work. Can 'json-iterator' deal with this condition? json example:
    see https://github.com/Katsusan/go-dota2/blob/master/livinggames.json

    "abilities":[  // <-这样的"abilities"键总共有 0-5 个(代表 各个dota2英雄的技能升级情况)
    {
    "ability_id":5106,   //唯一技能 ID
    "ability_level":2  //技能等级
    },
    {
    "ability_id":5107,
    "ability_level":3
    }
    ]
    ,
    "abilities":[
    {
    "ability_id":5082,
    "ability_level":3
    },
    {
    "ability_id":5083,
    "ability_level":2
    }
    ]
    ,
    "abilities":[
    {
    "ability_id":5122,
    "ability_level":3
    },
    {
    "ability_id":5123,
    "ability_level":2
    },
    {
    "ability_id":5125,
    "ability_level":1
    }
    ]
    
    opened by katsusan 6
  • []byte marshaled to null

    []byte marshaled to null

    One of the fuzz tests in Kubernetes caught an issue: This library:

    {"metadata":{"selfLink":"Ǭ`/F苫ŽȢ噯榋C","resourceVersion":"4597642297830476577"},"items":[{"metadata":{"name":"玿j情1 蔝","generateName":"萀枦đ ","uid":".愥+ǽķ蓧u岏V","resourceVersion":"13323996552230461162","creationTimestamp":null},"data":{"輣 兀zʩL:Ģ梸ïĭ":"MŞFƤ趻Ă癆萃猷S幸4"},"binaryData":{"Ȟ櫤薯WDZĥȂ":null}}]}
    

    encoding/json:

    {"metadata":{"selfLink":"Ǭ`/F苫ŽȢ噯榋C","resourceVersion":"4597642297830476577"},"items":[{"metadata":{"name":"玿j情1 蔝","generateName":"萀枦đ ","uid":".愥+ǽķ蓧u岏V","resourceVersion":"13323996552230461162","creationTimestamp":null},"data":{"輣 兀zʩL:Ģ梸ïĭ":"MŞFƤ趻Ă癆萃猷S幸4"},"binaryData":{"Ȟ櫤薯WDZĥȂ":""}}]}
    

    Notice how at the very end of the json the value in the map is not the same. BinaryData field is declared like this:

    BinaryData map[string][]byte `json:"binaryData,omitempty"`
    

    https://github.com/kubernetes/kubernetes/blob/8f20a815e5ef27d4d247e42bff90e42706397ca2/staging/src/k8s.io/api/core/v1/types.go#L4742

    Trying to migrate all encoding/json uses to this library in this PR https://github.com/kubernetes/kubernetes/pull/63284

    This is using commit 2ddf6d758266fcb080a4f9e054b9f292c85e6798

    opened by ash2k 6
  • Bug with FuzzyDecoders

    Bug with FuzzyDecoders

    ReadMapCB: expect { or n, parsing 24 ...aders":{"f... at {"id":3160,"headers":{ .......

    type Email struct { Id uint64

    Encoding gomail.Encoding
    Charset  string
    
    Headers     map[string]utility.StringArray
    Body        EmailBody
    Alternative []EmailBody
    Attachment  map[string]EmailBody
    
    UserData map[string]interface{} `json:"user_data"`
    

    }

    It always stuck at reading Id, and if I put "id" at the end of JSON i got EOF

    opened by 1stborn 6
  • serialize map  omitempty

    serialize map omitempty

    When serializing a map, Is there a way to ignore zero values ​​in map? I don't want zero values ​​inside map

    example:

    func TestMarshal(t *testing.T) {
    	m := map[string]interface{}{
    		"foo": "bar",
    		"int": 0,
    		"n":   nil,
    	}
    
    	bytes, err := jsoniter.Marshal(m)
    	assert.NoError(t, err)
    	t.Log(string(bytes))
    }
    
    output: {"int":0,"n":null,"foo":"bar"}
    

    want: {"foo":"bar"}

    opened by philhuan 0
  • circular reference causes  stack overflow

    circular reference causes stack overflow

    Test Code:

    package tests
    
    import (
    	"fmt"
    	"testing"
    
    	jsoniter "github.com/json-iterator/go"
    )
    
    var json2 = jsoniter.ConfigDefault
    
    type Node struct {
    	Name string `json:"name"`
    	Next *Node  `json:"next"`
    }
    
    func TestJson2(t *testing.T) {
    	n1 := Node{Name: "111", Next: nil}
    	n2 := Node{Name: "222", Next: &n1}
    	n3 := Node{Name: "333", Next: &n2}
    	n1.Next = &n3
    
    	fmt.Print("============== ")
    	json2.Marshal(n1)
    }
    

    causes stack overflow:

    runtime: goroutine stack exceeds 1000000000-byte limit runtime: sp=0xc0201e0348 stack=[0xc0201e0000, 0xc0401e0000] fatal error: stack overflow

    runtime stack: runtime.throw(0x62c0fd, 0xe) /root/go/src/runtime/panic.go:1116 +0x72 runtime.newstack() /root/go/src/runtime/stack.go:1034 +0x6ce runtime.morestack() /root/go/src/runtime/asm_amd64.s:449 +0x8f

    opened by linkxzhou 0
  • fix MarshalIndent when use SortMapKeys

    fix MarshalIndent when use SortMapKeys

    subStream fork not inherit indention field, may be this place has a same bug...

    https://github.com/json-iterator/go/blob/024077e996b048517130b21ea6bf12aa23055d3d/reflect_struct_encoder.go#L201-L207

    opened by kkHAIKE 0
  • 多个不同库的 RegisterTypeDecoderFunc 会覆盖?

    多个不同库的 RegisterTypeDecoderFunc 会覆盖?

    我用了 A 库 和 B 库,两者都设置了 RegisterTypeDecoderFunc,比如

    // 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 != "" {
    				var err error
    				if t, err = strconv.ParseBool(strings.ToLower(v)); err != nil {
    					iter.Error = err
    					return
    				}
    			}
    			*((*bool)(ptr)) = t
    		case jsoniter.NumberValue:
    			if v, err := iter.ReadNumber().Int64(); err != nil {
    				iter.Error = err
    				return
    			} else {
    				*((*bool)(ptr)) = v > 0
    			}
    		case jsoniter.NilValue:
    			iter.Skip()
    			*((*bool)(ptr)) = false
    		default:
    			*((*bool)(ptr)) = iter.ReadBool()
    		}
    	})
    
    // B 库
    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 != "" {
    				var err error
    				if t, err = strconv.ParseBool(strings.ToLower(v)); err != nil {
    					iter.Error = err
    					return
    				}
    			}
    			*((*bool)(ptr)) = t
    		case jsoniter.NumberValue:
    			if v, err := iter.ReadNumber().Int64(); err != nil {
    				iter.Error = err
    				return
    			} else {
    				*((*bool)(ptr)) = v == 0
    			}
    		case jsoniter.NilValue:
    			iter.Skip()
    			*((*bool)(ptr)) = false
    		default:
    			*((*bool)(ptr)) = iter.ReadBool()
    		}
    	})
    

    简单的说就是 A 库 1 看做是 True,而 B 库 0 看做是 True,如果同一个方法中同时使用了两个库,则会导致混乱。请问有什么办法避免吗?

    opened by hiscaler 0
  • Fails to parse valid JSON

    Fails to parse valid JSON

    I have a valid JSON object.

    {
      "id": "2489657257",
      "type": "PushEvent",
      "actor": {
        "id": 3170981,
        "login": "kulmala",
        "gravatar_id": "",
        "url": "https://api.github.com/users/kulmala",
        "avatar_url": "https://avatars.githubusercontent.com/u/3170981?"
      },
      "repo": {
        "id": 23549741,
        "name": "kulmala/metrics",
        "url": "https://api.github.com/repos/kulmala/metrics"
      },
      "payload": {
        "push_id": 536866759,
        "size": 1,
        "distinct_size": 1,
        "ref": "refs/heads/gh-pages",
        "head": "c1345d8d6ee6b1fcbb4bf98df5381b83a2d1d6c7",
        "before": "c4a492172b39d83a510142c164cef5b9aab15f2e",
        "commits": [
          {
            "sha": "c1345d8d6ee6b1fcbb4bf98df5381b83a2d1d6c7",
            "author": {
              "email": "[email protected]",
              "name": "Jaana Kulmala"
            },
            "message": "Site updated to bdfecdb",
            "distinct": true,
            "url": "https://api.github.com/repos/kulmala/metrics/commits/c1345d8d6ee6b1fcbb4bf98df5381b83a2d1d6c7"
          }
        ]
      },
      "public": true,
      "created_at": "2015-01-01T15:13:25Z"
    }
    

    But when I pass it through json-iterator/go I get:

    2022/07/11 18:50:13 ReadMapCB: expect { or n, but found , error found in #10 byte of ...|5:13:25Z"}
    |..., bigger context ...|"public":true,"created_at":"2015-01-01T15:13:25Z"}
    |...
    
    opened by eatonphil 1
Releases(v1.1.12)
  • v1.1.12(Sep 11, 2021)

  • v1.1.11(Apr 28, 2021)

    • Fixed json iter doesn't work properly with nil RawMessage #469
    • Fixed null in number json tag string (#480)
    • Fixed errors during reading integers from chunked io.Reader #477
    • Fixed nil pointer panic when Unmarshal with a empty file #508
    • Fixed [float string]different result vs origin after call Marshal & Unmarshal #510
    Source code(tar.gz)
    Source code(zip)
  • v1.1.10(Jun 9, 2020)

    • Fix #459 map keys of custom types should serialize using MarshalText when available
    • Fix potential panic in (*stringAny).ToInt64 and (*stringAny).ToUint64(see #450)
    • Fix #449 do NOT marshal the field whose name start with underscore
    • Reuse stream buffer and remove flush in (*Stream).WriteMore(see #441 #440)
    • Fix #421 simplify the error string returned by the decoder when it meets error unmarshaling anonymous structs
    • Fix #389 #411 do NOT marshal the json.RawMessage type field whose real type is integer/float as "null" with ValidateJsonRawMessage option enabled
    • Fix #326 do Not marshal private field after calling extra.SetNamingStrategy() to register naming strategy extension
    Source code(tar.gz)
    Source code(zip)
  • v1.1.6(Mar 12, 2019)

    • fix #311 handle nil any
    • fix #313 support json marshaller type as map key
    • fix #308 do NOT skip embedded structs without tag when OnlyTaggedField
    • fix #317, try parse as BigFloat if overflow
    • Fix trailing newline
    Source code(tar.gz)
    Source code(zip)
  • 1.1.5(Aug 6, 2018)

    fix #293 copy extensions fix #286 calcHash should use byte not rune to calc hash fix #291 omit empty was not handled properly for json raw message fix #295 decoder more was not compatible with standard library

    Source code(tar.gz)
    Source code(zip)
  • 1.1.4(Jul 1, 2018)

    • fix #250 case insensitive field match
    • explit test case sensitive for #252
    • fix #261 should load from reader
    • fix #260, support rename for extra.SupportPrivateFields
    • fix #263, support empty string as 0 in fuzz mode
    • fix #264 check io.EOF when test decoder.More
    • fix #274, unescape before base64 decode
    • Merge pull request #282 from caesarxuchao/optional-case-sensitivity
    • fix #276 allow rename when set naming strategy
    Source code(tar.gz)
    Source code(zip)
  • 1.1.3(Mar 18, 2018)

  • 1.1.2(Feb 28, 2018)

  • 1.1.1(Feb 23, 2018)

  • 1.1.0(Feb 22, 2018)

    Instead of let unsafe cast spread across the codebase, starting from 1.1.0, json-iterator use reflect2 (https://github.com/v2pro/plz/tree/master/reflect2) package to implement unsafe reflection. Aslo the map encoder/decoder has been rewritten to use unsafe reflection.

    Source code(tar.gz)
    Source code(zip)
  • 1.0.6(Feb 16, 2018)

    • support DisallowUnknownFields in golang 1.10
    • fix #236 distinguish upper/lower field names
    • improve marshal performance by https://github.com/json-iterator/go/pull/234
    Source code(tar.gz)
    Source code(zip)
  • 1.0.5(Jan 28, 2018)

    • use sync.Map or mutex to make encoder/decoder cache thread safe
    • fix #198 use vendoring
    • fix #200 removed symbolic link
    • fix #202 crash on custom map encoder
    • fix #207 Encoding nil pointer to struct containing exported function leads to marshalling error
    • fix #214 do not wrap EOF
    • fix #217 when input is "null", should not report error for unmarshallable type
    • fix #219 nested field with json tag 'omitempty' should not be marshalled if it has zero value
    • fix #227 incorrect marshalling of json.Number for empty string
    • fix #228 Any.ToInt() resulting not nil LastError()
    Source code(tar.gz)
    Source code(zip)
  • 1.0.4(Nov 15, 2017)

    #190 jsoniter.Get([]byte("")) will panic #191 support string escape for object fields #194 handle array larger than 1Gb #195 better error message when decoding float as int #197 placeholderEncoder encodes interface{} incorrectly, causing fatal error

    Source code(tar.gz)
    Source code(zip)
  • 1.0.3(Oct 12, 2017)

    • do not report error when field is unexported
    • #178 SkipAndReturnBytes should return copy of memory
    • #177 flush buffer should check available again
    • #180, add missing methods to jsoniter.Number
    • #181, support string as json.Number and jsoniter.Number
    • #184, support null as number
    • #183 limit error message size
    • #185 add jsoniter.Valid
    Source code(tar.gz)
    Source code(zip)
  • 1.0.2(Sep 18, 2017)

    Since 1.0.0, Merged Pull Requests

    • https://github.com/json-iterator/go/pull/172
    • https://github.com/json-iterator/go/pull/173
    • https://github.com/json-iterator/go/pull/170
    • https://github.com/json-iterator/go/pull/168
    • https://github.com/json-iterator/go/pull/167
    • added ValidateJsonRawMessage: true to ConfigCompatibleWithStandardLibrary
    Source code(tar.gz)
    Source code(zip)
Owner
Jsoniter
Jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
Jsoniter
Fast JSON encoder/decoder compatible with encoding/json for Go

Fast JSON encoder/decoder compatible with encoding/json for Go

Masaaki Goshima 1.7k Aug 7, 2022
My clean Go solution that's faster than 100%, takes up less memory than 100%.

Remove-element My very clean Go solution that's faster than 100% of all solutions on Leetcode. Leetcode Challenge: "Given an integer array nums and an

Daniel Pickens 0 Dec 24, 2021
go-eexcel implements encoding and decoding of XLSX like encoding/json

go-eexcel go-eexcel implements encoding and decoding of XLSX like encoding/json Usage func ExampleMarshal() { type st struct { Name string `eexce

sago35 0 Dec 9, 2021
Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

Description pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. pflag is compatible with the GNU extensions to

Steve Francia 1.9k Jul 28, 2022
Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

Description pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. pflag is compatible with the GNU extensions to

Alex Ogier 519 Jul 24, 2022
Highly concurrent drop-in replacement for bufio.Writer

concurrent-writer Highly concurrent drop-in replacement for bufio.Writer. concurrent.Writer implements highly concurrent buffering for an io.Writer ob

Alin Sinpalean 44 Jun 21, 2022
Drop-in replacement for the standard library errors package and github.com/pkg/errors

Emperror: Errors Drop-in replacement for the standard library errors package and github.com/pkg/errors. This is a single, lightweight library merging

Emperror 152 Jul 26, 2022
A drop-in replacement for Go errors, with some added sugar! Unwrap user-friendly messages, HTTP status code, easy wrapping with multiple error types.

Errors Errors package is a drop-in replacement of the built-in Go errors package with no external dependencies. It lets you create errors of 11 differ

Kamaleshwar 42 May 18, 2022
Zero downtime restarts for go servers (Drop in replacement for http.ListenAndServe)

endless Zero downtime restarts for golang HTTP and HTTPS servers. (for golang 1.3+) Inspiration & Credits Well... it's what you want right - no need t

Florian von Bock 3.6k Jul 26, 2022
a simple & tiny scrapy clustering solution, considered a drop-in replacement for scrapyd

scrapyr a very simple scrapy orchestrator engine that could be distributed among multiple machines to build a scrapy cluster, under-the-hood it uses r

Mohammed Al Ashaal 50 Nov 24, 2021
🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint

revive Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. Revive provides a framework for developme

Minko Gechev 3.6k Aug 7, 2022
drpc is a lightweight, drop-in replacement for gRPC

drpc is a lightweight, drop-in replacement for gRPC

Storj Labs 1.1k Jul 28, 2022
Drop-in replacement for Go net/http when running in AWS Lambda & API Gateway

Package gateway provides a drop-in replacement for net/http's ListenAndServe for use in AWS Lambda & API Gateway, simply swap it out for gateway.Liste

Apex 631 Jul 30, 2022
Drop-in replacement for Go's stringer tool with support for bitflag sets.

stringer This program is a drop-in replacement for Go's commonly used stringer tool. In addition to generating String() string implementations for ind

null 0 Nov 26, 2021
twtr (pronounced "tweeter") is a drop-in replacement of the original twtxt client

twtr twtr (pronounced "tweeter") is a drop-in replacement of the original twtxt client, with some extensions and bonus features, so you can make the s

~duriny 1 Jun 24, 2022
A drop-in replacement to any Writer type, which also calculates a hash using the provided hash type.

writehasher A drop-in replacement to any Writer type, which also calculates a hash using the provided hash type. Example package main import ( "fmt"

Max 0 Jan 10, 2022
Goslmailer (GoSlurmMailer) is a drop-in replacement MailProg for slurm

GoSlurmMailer - drop in replacement for default slurm MailProg. Delivers slurm job messages to various destinations.

PetarJ 2 May 16, 2022
🔑A high performance Key/Value store written in Go with a predictable read/write performance and high throughput. Uses a Bitcask on-disk layout (LSM+WAL) similar to Riak.

bitcask A high performance Key/Value store written in Go with a predictable read/write performance and high throughput. Uses a Bitcask on-disk layout

James Mills 7 Apr 15, 2022
✨ #PTerm is a modern go module to beautify console output. Featuring charts, progressbars, tables, trees, and many more 🚀 It's completely configurable and 100% cross-platform compatible.

?? PTerm | Pretty Terminal Printer A golang module to print pretty text Show Demo Code PTerm.sh | Installation | Documentation | Quick Start | Example

null 2.9k Jul 29, 2022
the pluto is a gateway new time, high performance, high stable, high availability, easy to use

pluto the pluto is a gateway new time, high performance, high stable, high availability, easy to use Acknowledgments thanks nbio for providing low lev

mobus 2 Sep 19, 2021
High-performance framework for building redis-protocol compatible TCP servers/services

Redeo The high-performance Swiss Army Knife for building redis-protocol compatible servers/services. Parts This repository is organised into multiple

Black Square Media 416 Aug 3, 2022
cyhone 108 Jul 30, 2022
go-fastdfs 是一个简单的分布式文件系统(私有云存储),具有无中心、高性能,高可靠,免维护等优点,支持断点续传,分块上传,小文件合并,自动同步,自动修复。Go-fastdfs is a simple distributed file system (private cloud storage), with no center, high performance, high reliability, maintenance free and other advantages, support breakpoint continuation, block upload, small file merge, automatic synchronization, automatic repair.(similar fastdfs).

中文 English 愿景:为用户提供最简单、可靠、高效的分布式文件系统。 go-fastdfs是一个基于http协议的分布式文件系统,它基于大道至简的设计理念,一切从简设计,使得它的运维及扩展变得更加简单,它具有高性能、高可靠、无中心、免维护等优点。 大家担心的是这么简单的文件系统,靠不靠谱,可不

小张 3.2k Aug 1, 2022
LinDB is an open-source Time Series Database which provides high performance, high availability and horizontal scalability.

LinDB is an open-source Time Series Database which provides high performance, high availability and horizontal scalability. LinDB stores all monitoring data of ELEME Inc, there is 88TB incremental writes per day and 2.7PB total raw data.

LinDB 2.3k Jul 30, 2022
Fallback to build simdjson-go tape using only encoding/json

fakesimdjson builds a simdjson-go tape using the stdlib's JSON parser. It is slow and does a lot of allocations. This is a workaround to run programs

Kiwi.com 1 Mar 11, 2022
A web based drag and drop file transfer tool for sending files across the internet.

DnD A file transfer tool. Demo Usage Get go get github.com/0xcaff/dnd or download the latest release (you don't need go to run it) Run dnd Now navig

Martin Charles 18 Feb 18, 2022
go-pry - an interactive REPL for Go that allows you to drop into your code at any point.

go-pry go-pry - an interactive REPL for Go that allows you to drop into your code at any point. Example Usage Install go-pry go get github.com/d4l3k/g

Tristan Rice 2.9k Jul 28, 2022
Evmos is a scalable, high-throughput Proof-of-Stake blockchain that is fully compatible and interoperable with Ethereum.

Evmos Evmos is a scalable, high-throughput Proof-of-Stake blockchain that is fully compatible and interoperable with Ethereum. It's built using the Co

Tharsis 1.3k Aug 4, 2022
Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges

Kelp Kelp is a free and open-source trading bot for the Stellar universal marketplace and for centralized exchanges such as Binance, Kraken, CoinbaseP

Stellar 911 Aug 4, 2022