Option 1. Using python
cat FileName.json | python -m json.tool
Option 2. Colors and multiple options.
cat FileName.json~ | jq ''
Option 3. Pretty print with syntax highlighting.
echo '{"foo": "bar"}' | python -m json.tool | pygmentize -g
Option 1. Using python
cat FileName.json | python -m json.tool
Option 2. Colors and multiple options.
cat FileName.json~ | jq ''
Option 3. Pretty print with syntax highlighting.
echo '{"foo": "bar"}' | python -m json.tool | pygmentize -g
For further actions, you may consider blocking this person and/or reporting abuse
Max Bohomolov -
Alexis Kypridemos -
CodeWithVed -
Kyle Pena -
Top comments (5)
Note, option 2 is fine, but no good if you are dealing with long integers (more than 53 bit) as JavaScript mangles the numbers.
Could you elaborate a little further? jq is built in C
Sure. Let's assume the following small JSON:
(hint, these are values from a Tweet object in the Twitter API)
Now, let's parse this with jq:
The large integer value is mangled, because JavaScript (jQuery) does not like values larger than 53 bits. This is the reason that Twitter ended up serving IDs as both integer values and as strings (read more here)
Well every day is a learning day. I didn't know C had the same issues as JS with integer parsing.
Thanks for clarifying.
I guess this issue is relevant here:
github.com/stedolan/jq/issues/369