Optimized JSON for Go is a high performance parser with a variety of
additional JSON tools. OjG is optimized to processing huge data sets
where data does not necessarily conform to a fixed structure.
Features
Fast JSON parser. Check out the cmd/benchmarks app in this repo.
Full JSONPath implemenation that operates on simple types as well as structs.
Generic types. Not the proposed golang generics but type safe JSON elements.
Fast JSON validator (7 times faster with io.Reader).
Fast JSON writer with a sort option (4 times faster).
JSON builder from JSON sources using a simple assembly plan.
Simple data builders using a push and pop approach.
Object encoding and decoding using an approach similar to that used with Oj for Ruby.
The oj command (cmd/oj) uses JSON path for filtering and
extracting JSON elements. It also includes sorting, reformatting, and
colorizing options.
$ oj -m "(@.name == 'Pete')" myfile.json
More complete examples are available in the go docs for most
functions. The example for Unmarshalling
interfaces demonstrates a feature that
allows interfaces to be marshalled and unmarshalled.
Installation
go get github.com/ohler55/ojg
go get github.com/ohler55/ojg/cmd/oj
请发表评论