🎉 GoJSON 🚀 - A command-line utility to jazz up your JSON handling!
🛠️ Built for fun during a never-ending 3-hour meeting where I just nodded along. 🙃 If you're scouting for some seriously useful JSON command-line tools, check out the list below!
- dsq - Tool for running SQL queries against JSON, CSV, Excel, Parquet, and more.
- fx - A interactive terminal tool.
- jo - A small utility to create JSON objects
- jsoncat - Pretty-print Json in terminal with colors and adjusting tabs size.
- jq - A lightweight and flexible command-line JSON processor.
- json - A "json" command for massaging JSON on your Unix command line.
- jshon - A parser designed for maximum convenience within the shell.
- jarg - Shorthand JSON and form encoding syntax in the shell.
- jsawk - Like awk, but for JSON.
- json-dotenv - Manipulate and extract envfiles in json format.
- gron - Convert a JSON file into discrete assignments that are greppable.
- jid - Incremental Digger. Drill down JSON interactively by using filtering queries like jq.
- jiq - It's
jid
withjq
. You can drill down interactively by usingjq
filtering queries. - jv - jv (for jsonviewer) helps you view your JSON.
- jl - Functional sed for JSON.
- oj - A fast and flexible command line JSON processor.
- visidata - A terminal spreadsheet-like tool for interactively exploring data.
- Retrieve nested objects
- Pretty print JSON
- Validate JSON
- Aggregate functions
Go Dev version
go install github.com/sarathsp06/gojson@latest
Binray Release
download and use the binary as such for your platform
Tip:
In unix move the binary to PATH
- Key is a set of
.
seperated nested values - Can use 0-n numbers to refer to index in arrays
- Can use
lower:upper
syntax to refer to a range of an array. Eg: players.1:3 - Can use keys of inner objects directly on arrays or range of them. Eg: players.name where players is an array
- Get a string:
$ echo '{"name":{"first":"Sarath","last":"Pillai"}}' | gojson name.last
"Pillai"
- Get a block of JSON:
$ echo '{"name":{"first":"Sarath","last":"Pillai"}}' | gojson name
{
"first": "Sarath",
"last": "Pillai"
}
- Try to get a non-existent key:
$ echo '{"name":{"first":"Sarath","last":"Pillai"}}' | gojson names
nil
- Get an array value by index:
$ echo '{"people":[{"name":"saratha"},{"name":"syam"}]}' | gojson people.1.name
"syam"
- Projection from a slice
$ echo '{"people":[{"name":"saratha"},{"name":"syam"},{"name":"singh"},{"name":"ping"}]}' | gojson people.2:.name
[
"singh",
"ping"
]
- Slice of array
$ echo '{"people":[{"name":"saratha"},{"name":"syam"},{"name":"singh"},{"name":"ping"}]}' | gojson people.2:5
[
{
"name": "singh"
},
{
"name": "ping"
}
]
- Handling JSON key names with a
.
:
$ echo '{"first.name":"Sarath","last.name":"Pillai"}' | gojson \"first.name\"
"Sarath"