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
  • fatal error: concurrent map writes on new type of map initialization

    fatal error: concurrent map writes on new type of map initialization

    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?, 0xc139ab65d0?, 0x8?)
    \t/usr/local/go/src/runtime/map.go:595 +0x4d6 fp=0xc12c758108 sp=0xc12c758088 pc=0x40f3b6
    github.com/json-iterator/go.createEncoderOfType(0xc139ab6660, {0x146c570, 0xc0003923f0})
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:244 +0x9f fp=0xc12c758148 sp=0xc12c758108 pc=0x97a59f
    github.com/json-iterator/go.encoderOfType(0xc139ab6660, {0x146c570, 0xc0003923f0})
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:227 +0x45 fp=0xc12c7581a0 sp=0xc12c758148 pc=0x97a3a5
    github.com/json-iterator/go.encoderOfMapKey(0xc139ab6660, {0x146c570?, 0xc0003923f0})
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_map.go:133 +0x350 fp=0xc12c758218 sp=0xc12c7581a0 pc=0x980b50
    github.com/json-iterator/go.(*dynamicMapKeyEncoder).Encode(0xc1615cad98, 0xc153ca5bc8?, 0xc12c7582b0?)
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_map.go:237 +0x72 fp=0xc12c758250 sp=0xc12c758218 pc=0x981472
    github.com/json-iterator/go.(*mapEncoder).Encode(0xc139ab6690, 0xc153ca5bc8, 0xc100ae0180)
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_map.go:263 +0x3c9 fp=0xc12c7582f8 sp=0xc12c758250 pc=0x981929
    github.com/json-iterator/go.(*onePtrEncoder).Encode(0xc13537e8a0, 0xc19fac49f0, 0xc12c758370?)
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:219 +0x82 fp=0xc12c758330 sp=0xc12c7582f8 pc=0x97a322
    github.com/json-iterator/go.(*Stream).WriteVal(0xc100ae0180, {0x10b1d60, 0xc19fac49f0})
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:98 +0x158 fp=0xc12c7583a0 sp=0xc12c758330 pc=0x979638
    github.com/json-iterator/go.(*dynamicEncoder).Encode(0xc100ae0180?, 0xc19facc584?, 0x3?)
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_dynamic.go:15 +0x39 fp=0xc12c7583d0 sp=0xc12c7583a0 pc=0x97bcf9
    github.com/json-iterator/go.(*placeholderEncoder).Encode(0xc00955ad80?, 0xc19fad22d0?, 0x40d4e5?)
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:332 +0x22 fp=0xc12c7583f8 sp=0xc12c7583d0 pc=0x97ad62
    github.com/json-iterator/go.(*mapEncoder).Encode(0xc139b94960, 0xc19fad22d0, 0xc100ae0180)
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_map.go:269 +0x243 fp=0xc12c7584a0 sp=0xc12c7583f8 pc=0x9817a3
    github.com/json-iterator/go.(*structFieldEncoder).Encode(0xc139b94ae0, 0xfa3a5d?, 0xc100ae0180)
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_struct_encoder.go:110 +0x56 fp=0xc12c758518 sp=0xc12c7584a0 pc=0x98f6f6
    github.com/json-iterator/go.(*structEncoder).Encode(0xc139b94bd0, 0x0?, 0xc100ae0180)
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_struct_encoder.go:158 +0x765 fp=0xc12c758600 sp=0xc12c758518 pc=0x990105
    github.com/json-iterator/go.(*OptionalEncoder).Encode(0xc0003b4000?, 0x0?, 0x0?)
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_optional.go:70 +0xa4 fp=0xc12c758650 sp=0xc12c758600 pc=0x9872c4
    github.com/json-iterator/go.(*onePtrEncoder).Encode(0xc13bf7aef0, 0xc19fad22c0, 0xc19fac4b10?)
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:219 +0x82 fp=0xc12c758688 sp=0xc12c758650 pc=0x97a322
    github.com/json-iterator/go.(*Stream).WriteVal(0xc100ae0180, {0x10949c0, 0xc19fad22c0})
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:98 +0x158 fp=0xc12c7586f8 sp=0xc12c758688 pc=0x979638
    github.com/json-iterator/go.(*frozenConfig).MarshalToString(0xc0003b4000, {0x10949c0, 0xc19fad22c0})
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/config.go:289 +0xa6 fp=0xc12c758770 sp=0xc12c7586f8 pc=0x970546
    github.com/json-iterator/go.MarshalToString(...)
    \t/go/pkg/mod/github.com/json-iterator/[email protected]/adapter.go:44
    ...
    

    The code

    import 	"github.com/aerospike/aerospike-client-go/v5"
    func MarshalJSON(r *aerospike.Record) string {
    	res, _ := jsoniter.MarshalToString(r)
    	return res
    }
    

    Env

    golang:1.18.0
    github.com/json-iterator/go v1.1.12
    
    opened by un000 3
  • Marshaling niladic methods on struct to their values

    Marshaling niladic methods on struct to their values

    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:

    type A struct {
        Foo string
        Bar string
    }
    
    type (a A) Baz() int {
        return len(a.Foo) + len(a.Bar)
    }
    
    a := A{
        Foo: "spam",
        Bar: "eggs",
    }
    

    Marshaling a would result in the following JSON:

    {
        "Foo": "spam",
        "Bar": "eggs",
        "Baz": 8
    }
    

    Is it possible to achieve this behaviour? If not, can it be implemented? I'm willing to try my hand at a PR.

    opened by ewen-lbh 0
  • `ReadStringAsSlice` seems to copy the underlying slice.

    `ReadStringAsSlice` seems to copy the underlying slice.

    I may misunderstand the idea behind iter.ReadStringAsSlice. The documentation states:

    ReadStringAsSlice read string from iterator without copying into string form. The []byte can not be kept, as it will change after next iterator call.

    However, the bytes are actually copied if I'm not mistaken. So I'm wondering why can the returned []byte not be kept longer? Also, would it be possible to have a read without any copying and allocation which returned iter.buf[iter.head:iter.tail]?

    opened by jeschkies 0
  • SIGSEGV decoding 1.2 GB JSON file

    SIGSEGV decoding 1.2 GB JSON file

    darwin/arm64 on Go 1.18.

    Using function to copy from one *os.File to another.

    func prettyIter(w io.Writer, r io.Reader) error {
    	json := jsoniter.ConfigCompatibleWithStandardLibrary
    	d := json.NewDecoder(r)
    	e := json.NewEncoder(w)
    	e.SetIndent(" ", "  ")
    	for {
    		var v interface{}
    		if err := d.Decode(&v); err != nil {
    			if errors.Is(err, io.EOF) {
    				break
    			}
    			return err
    		}
    		if err := e.Encode(v); err != nil {
    			return err
    		}
    	}
    	return nil
    }
    
    unexpected fault address 0x360808085a175a75
    fatal error: fault
    [signal SIGSEGV: segmentation violation code=0x2 addr=0x360808085a175a75 pc=0x104e1a5b0]
    
    goroutine 1 [running]:
    runtime.throw({0x104ea7de5?, 0xd0?})
    	/usr/local/go/src/runtime/panic.go:992 +0x50 fp=0x14056c8d890 sp=0x14056c8d860 pc=0x104defb40
    runtime.sigpanic()
    	/usr/local/go/src/runtime/signal_unix.go:825 +0x1a4 fp=0x14056c8d8c0 sp=0x14056c8d890 pc=0x104e05c54
    aeshashbody()
    	/usr/local/go/src/runtime/asm_arm64.s:874 +0x2d0 fp=0x14056c8d8d0 sp=0x14056c8d8d0 pc=0x104e1a5b0
    runtime.mapiternext(0x14000010180)
    	/usr/local/go/src/runtime/map.go:934 +0x2c4 fp=0x14056c8d940 sp=0x14056c8d8d0 pc=0x104dcd5c4
    runtime.mapiterinit(0x14056c8d9e8?, 0x104dcb020?, 0x141e5da7888?)
    	/usr/local/go/src/runtime/map.go:861 +0x2f0 fp=0x14056c8d970 sp=0x14056c8d940 pc=0x104dcd2c0
    reflect.mapiterinit(0x14056c8da68?, 0x104dcabb0?, 0x14056c8da98?)
    	/usr/local/go/src/runtime/map.go:1373 +0x20 fp=0x14056c8d9a0 sp=0x14056c8d970 pc=0x104e181f0
    github.com/modern-go/reflect2.(*UnsafeMapType).UnsafeIterate(...)
    	/Users/eric/gopath/pkg/mod/github.com/modern-go/[email protected]/unsafe_map.go:112
    github.com/json-iterator/go.(*sortKeysMapEncoder).Encode(0x141e5daca20, 0x1400000e078, 0x1400012c1e0)
    	/Users/eric/gopath/pkg/mod/github.com/json-iterator/[email protected]/reflect_map.go:291 +0x244 fp=0x14056c8db10 sp=0x14056c8d9a0 pc=0x104e8e674
    github.com/json-iterator/go.(*onePtrEncoder).Encode(0x141e5daef20, 0x14000113d70, 0x14000010180?)
    	/Users/eric/gopath/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:219 +0x8c fp=0x14056c8db50 sp=0x14056c8db10 pc=0x104e8728c
    github.com/json-iterator/go.(*Stream).WriteVal(0x1400012c1e0, {0x104ee6c60, 0x14000113d70})
    	/Users/eric/gopath/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:98 +0x174 fp=0x14056c8dbd0 sp=0x14056c8db50 pc=0x104e86654
    github.com/json-iterator/go.(*dynamicEncoder).Encode(0x104ee11e0?, 0x141e5da7888?, 0x0?)
    	/Users/eric/gopath/pkg/mod/github.com/json-iterator/[email protected]/reflect_dynamic.go:15 +0x40 fp=0x14056c8dc00 sp=0x14056c8dbd0 pc=0x104e88a30
    github.com/json-iterator/go.(*sliceEncoder).Encode(0x1400011e0a8, 0x1400011e030, 0x1400012c1e0)
    	/Users/eric/gopath/pkg/mod/github.com/json-iterator/[email protected]/reflect_slice.go:38 +0x2f4 fp=0x14056c8dcc0 sp=0x14056c8dc00 pc=0x104e942b4
    github.com/json-iterator/go.(*Stream).WriteVal(0x1400012c1e0, {0x104edf1a0, 0x1400011e030})
    	/Users/eric/gopath/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:98 +0x174 fp=0x14056c8dd40 sp=0x14056c8dcc0 pc=0x104e86654
    github.com/json-iterator/go.(*Encoder).Encode(0x1400012a218, {0x104edf1a0?, 0x1400011e030?})
    	/Users/eric/gopath/pkg/mod/github.com/json-iterator/[email protected]/adapter.go:127 +0x34 fp=0x14056c8dd90 sp=0x14056c8dd40 pc=0x104e7c684
    main.prettyIter({0x12bf19920, 0x14000110d10}, {0x104f086c8?, 0x1400012a208?})
    	/Users/eric/git/pkg/cmd/pretty/main.go:112 +0xd4 fp=0x14056c8de00 sp=0x14056c8dd90 pc=0x104ea75c4
    main.pretty({0x12bf19920?, 0x14000110d10?}, {0x104f086c8?, 0x1400012a208?})
    	/Users/eric/git/pkg/cmd/pretty/main.go:75 +0x30 fp=0x14056c8de30 sp=0x14056c8de00 pc=0x104ea74b0
    main.main1()
    	/Users/eric/git/pkg/cmd/pretty/main.go:52 +0x340 fp=0x14056c8df30 sp=0x14056c8de30 pc=0x104ea7270
    main.main()
    	/Users/eric/git/pkg/cmd/pretty/main.go:18 +0x20 fp=0x14056c8df70 sp=0x14056c8df30 pc=0x104ea6ef0
    runtime.main()
    	/usr/local/go/src/runtime/proc.go:250 +0x250 fp=0x14056c8dfd0 sp=0x14056c8df70 pc=0x104df2080
    runtime.goexit()
    	/usr/local/go/src/runtime/asm_arm64.s:1259 +0x4 fp=0x14056c8dfd0 sp=0x14056c8dfd0 pc=0x104e1cf74
    exit status 2
    
    opened by ericlagergren 1
  • how do i dynamically change the structs json tag

    how do i dynamically change the structs json tag

    I'm referencing a struct of third-party library, eg look like:

    type User struct {
        ID   int64  `json:"id"`
        Name string `json:"first"` // want to change this to `json:"name"`
        tag  string `json:"-"`
        Another
    }
    
    type Another struct {
        Address string `json:"address"`
    }
    

    I now have the following:

    package main
    
    import (
        "encoding/json"
        "fmt"
        "os"
    )
    type MyUser User
    
    func main() {
            anoth := Another{"123 Jennings Street"}
        _ = json.NewEncoder(os.Stdout).Encode(
            &MyUser {1, "Ken Jennings", "name",
                 anoth},
        )
    }
    

    I am trying to json encode the struct but before I do I need to change the json key...eg the final json should look like:

    {"id": 1, "name": "Ken Jennings", "address": "123 Jennings Street"}
    

    how can i do it

    opened by lm2333 0
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
A high-performance, zero allocation, dynamic JSON Threat Protection in pure Go

Package gojtp provides a fast way to validate the dynamic JSON and protect against vulnerable JSON content-level attacks (JSON Threat Protection) based on configured properties.

Ankur Anand 54 Jun 15, 2022
JSON:API compatible query string parser

QParser The package helps to parse part of the URL path and its parameters string to a handy structure. The structure format is compatible with the JS

Velmie 1 Dec 21, 2021
Go encoder and decoder for the NetBPM/PNM image formats. Compatible with Go's image packages.

gpnm This package implements an encoder and decoder for PNM image formats. It can be used with Go's image library. It covers all formats as defined by

null 0 Nov 26, 2021
A Small tool for SDWAN performance test and policy validation

sdwan-perf Sdwan-perf is based on golang and could support almost platform for performance and policy validation. SDWAN Performance Test Report +--

Mie~~~ 16 May 14, 2022
Example to validate performance using append or not in golang

benchtest-arr-go This code is a example to validate performance using append or not in golang result benchtests go test -benchmem -bench . goos: darwi

Renan Bastos 1 Jan 10, 2022
A high-performance 100% compatible drop-in replacement of "encoding/json"

A high-performance 100% compatible drop-in replacement of "encoding/json" You can also use thrift like JSON using thrift-iterator Benchmark Source cod

Jsoniter 11k Jun 23, 2022
Fast JSON encoder/decoder compatible with encoding/json for Go

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

Masaaki Goshima 1.6k Jun 26, 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.8k Jun 29, 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 516 Jun 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 146 Jun 20, 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.5k Jun 21, 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 Jun 25, 2022
drpc is a lightweight, drop-in replacement for gRPC

drpc is a lightweight, drop-in replacement for gRPC

Storj Labs 1.1k Jun 25, 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 626 Jun 28, 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
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
✨ #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.6k Jun 21, 2022
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 414 Jun 22, 2022
cyhone 102 Jun 22, 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 Jun 30, 2022