Comment

Comment by iopuy

Hey guys, I work with JSON on a daily basis on machines that don't have access to jq. My advice to you in similar situations is as follows:

To pretty print JSON:

    cat myjson.json | python -m json.tool > prettyPrinted.json
To validate json:

    cat myjson.json | python -m json.tool
    echo $?
If the result is 0 it is well formed and 1 otherwise. You can also pretty print JSON by opening the scratchpad in firefox and clicking the "Pretty print" button.
parent iopuy 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton