I\'ve a file with a sequence of JSON element:
{ element0: \"lorem\", value0: \"ipsum\" }
{ element1: \"lorem\", value0: \"ipsum\" }
...
{ elementN: \"lorem\"
with python (2 and 3):
alias prettify_json="python -c 'import sys ;import json ; print(json.dumps(json.loads(sys.stdin.read()), indent=4))'"
or with ruby:
alias prettify_json="ruby -e \"require 'json';puts JSON.pretty_generate(JSON.parse(STDIN.read))\""
you can use:
echo '{"bar": "abc", "foo": "def"}' | prettify_json
curl http://.../file.json | prettify_json