JSON validator and formatter
JSON validation with the error's place and cause; pretty print, minify and a tree.
Result
Tree
Path for jq
Calculated in your browser — nothing is sent to the server
In a Linux terminal
jq . config.json
# validate and pretty print
jq -c . config.json
# on one line
jq '.services.web.image' compose.json
# the value at a path
jq empty daemon.json && systemctl restart docker
# restart only if the JSON is valid
python3 -m json.tool config.json
# validate without jq
Keep in mindJSON has no comments and no comma after the last item: the most common mistakes when you edit a config by hand.
FAQ
Why does my JSON fail validation when it works in code?
It is a JavaScript or Python object, not JSON: single quotes, unquoted keys, a trailing comma,
comments, True and None.
How do I minify JSON to one line?
Choose the “One line” view: spaces and line breaks go, the data stays the same. In the terminal,
use jq -c ..
What does “number larger than 2⁵³” mean?
JavaScript stores numbers as 64-bit floating point, so integers above 9,007,199,254,740,991 lose precision. Send such IDs as strings.