Json Viewer
What is a Json Viewer?
APIs, logs and databases often return JSON as one long minified line. The JSON viewer parses it and prints it with clean indentation so you can read the structure, spot the value you need and check that the JSON is valid. If the input is broken, it tells you where the error is.
How to use it
- Paste JSON into the input.
- Read the formatted output, or the error message with the position of the problem.
- Copy the prettified JSON.
Example
Input (double quotes in real JSON):
{'user':{'id':42,'name':'Asha','roles':['admin','dev']},'active':true}Output:
{
'user': {
'id': 42,
'name': 'Asha',
'roles': [
'admin',
'dev'
]
},
'active': true
}The most common JSON syntax errors
- Trailing comma after the last item:
[1, 2, ]. - Single quotes around strings or keys; JSON requires double quotes.
- Unquoted keys such as
{ name: 'x' }, valid in JavaScript but not in JSON. - Comments, which standard JSON does not allow.
- Special values like
NaN,Infinityorundefined. - Unescaped characters such as a raw line break inside a string.
Tips
- Two-space indentation is the most common convention; four spaces is common in Python projects.
- From the terminal,
jq .orpython -m json.tooldo the same job. - Large numbers above 2^53 lose precision when parsed in JavaScript; IDs should be sent as strings.
Your JSON is parsed locally and never uploaded.
Frequently Asked Questions
How do I format JSON?
Paste it into the viewer. It parses the data and prints it with consistent indentation.
Why is my JSON invalid?
Common causes are trailing commas, single quotes, unquoted keys, comments and unescaped line breaks.
Does formatting change my data?
No. Only whitespace changes. Keys, values and order stay the same.
Is my JSON sent to a server?
No. Parsing and formatting happen entirely in your browser.