bitly / go-simplejson

a Go package to interact with arbitrary JSON
MIT License
3.76k stars 498 forks source link

How to deal with json data with multiple same key #59

Closed liboshi closed 7 years ago

liboshi commented 7 years ago

Hi

I have json data like this: { "samekey": "value1", "samekey": "value2", "samekey": "value3" }

How to get the third one? I mean that which built-in function should I use.

Thanks in advance.

jehiah commented 7 years ago

You will need to use encoding/json.Decoder.Token() to accomplish that

https://play.golang.org/p/DuLOeCGSWX