JavaScript Object Notation.
For JSON basics, read Wikipedia.
Useful JSON tools:
https://github.com/tomnomnom/gron
Flattens JSON to be greppable.
gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" |
fgrep "commit.author"
unflatten back to expanded JSON:
gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" |
fgrep "commit.author" |
gron -u
JSON Query filters json inputs - file or stdin.
Pre-compiled C available for all platforms.
Widely used in my scripts in DevOps-Bash-tools repo.
https://jqlang.github.io/jq/tutorial/
https://jqlang.github.io/jq/manual/
Interactive JSON viewer.
Useful to quickly create jq
queries by drilling down interactively.
cat data.json | jnv
or
jnv data.json
Tab
completion.
Ctrl
-q
- copy jq
query to clipboard to paste to code.
Ctrl
-o
- copy the JSON to clipboard.
- Jackson
- Gson
xml2json
json2csv
Perl JSON::XS
CPAN module (doesn't sort keys):
json_xs
Python 2.6+ (sorts keys):
python -m json.tool
From DevOps-Bash-tools, recursively find and lint all *.json
files:
check_json.sh
From DevOps-Python-tools, recursively find and lint all *.json
files:
validate_json.py .
I run these automatically in all my GitHub repos via CI/CD.