In python, If I have a JSON object obj
, then I can
print json.dumps(obj, sort_keys=True, indent=4)
in order to get a pretty printout of the object. Is it possible to prettify the output even further: add some colors in particular? Something like the result of [1]
cat foo.json | jq '.'
[1] jq
the JSON Swiss Army toolbox: http://stedolan.github.io/jq/
jq
? What does it do?jq
as a subprocess from Python) but if you are asking: "is there a way to do that with the built-in json library" then the answer is "no".