cat a json file - with pretty print
jq . /path/to/json_file
Select a single key
jq '.path.to.key'
The command above will return "42" for a json that looks like "{path: {to: {key: 42}}}"
Delete all entries in an object, except for one
jq '.foo|=bar'
The command above will return "{foo: {bar:''}}" for a json that looks like "{foo: {bar:'', baz: ''}}"
This is probably not even enough to get started. Luckily there's plenty of docs to read @ https://stedolan.github.io/jq/manual/
Coincidence. Using recently this tool as well. Might be good to mentioned to your message:
ReplyDelete-r .......... option to output raw format
[1] ........ indexing elements of json array
/Vasiliy
That's awesome, thanks!
ReplyDeleteThanks. Very useful tool.
ReplyDelete