daft_pink
18 hours ago
Also want to point out that the jq cli, brew install jq on mac will also process json by typing "cat yourfile.json | jq .” or interactively with "jq . <<< '{"key": "value”}’”
Just wanted to point this out, because often I don’t want to put my private json data into some rando website.
latexr
17 hours ago
> the jq cli, brew install jq on Mac
You no longer need to install it with Homebrew. jq ships with macOS Sequoia in /usr/bin.
Macha
18 hours ago
Also if you don't want `jq` installed, `python` will also do it with `cat your.json | python -m json.tool`
latexr
17 hours ago
Python no longer comes preinstalled with macOS. Though running any command against /usr/bin/python3 will make macOS prompt you about installing the Xcode Developer Tools (takes two clicks), which does get you Python.
Anyway, jq now ships with macOS Sequoia.
For older versions of macOS, using JavaScript for Automation is preinstalled and gets the job done with a bit more verbosity:
osascript -l JavaScript -e 'function run(argv) { return JSON.stringify(JSON.parse(argv[0]),null,2) }' '{"key": "value"}'