Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Also if you don't want `jq` installed, `python` will also do it with `cat your.json | python -m json.tool`


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"}'




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: