Hacker News new | ask | show | jobs
by nicksardo 3878 days ago
https://github.com/nicksardo/jsonpath can pull out parts of a JSON document without unmarshalling.
1 comments

That's really neat, thanks (do you have any benchmarks comparing it to Go's JSON?), but doesn't cover my use case. I want all the values in a map-like API. I don't know anything about the shape of the contents, names of the keys, etc.
Which libraries have you looked at? https://github.com/pquerna/ffjson and https://github.com/benbjohnson/megajson claim to be faster
Looked at both. ffjson is a library that generates the marshaling/unmarshaling Go code for your structs, so it doesn't support my use case at all. megajson is abandonware ("This tool is unmaintained. Please use ffjson instead").

go-codec [1] is very good, and can do things like interning string keys to reduce allocation overhead, but it's not faster than encoding/json when working on plain maps.

[1] https://github.com/ugorji/go