When to use it
- An API response on one long line: expand JSON copied from developer tools or logs to see its structure
- A config file that will not load: when a program only says “invalid JSON”, find the exact line and character
- Smaller payloads: strip indentation and line breaks to send less data
- Checking JSON made from a spreadsheet: view the output of XLSX to JSON in a readable layout
Common errors and how to fix them
| Message | Wrong | Right |
|---|---|---|
| Comma after the last item | {"a": 1, "b": 2,} |
{"a": 1, "b": 2} |
| Single quotes | {'name': 'Kim'} |
{"name": "Kim"} |
| Key without quotes | {name: "Kim"} |
{"name": "Kim"} |
| Missing comma between items | {"a": 1 "b": 2} |
{"a": 1, "b": 2} |
| Backslash followed by something not allowed | {"path": "C:\Users"} |
{"path": "C:\\Users"} |
| Comments are not allowed | {"a": 1 // note} |
{"a": 1} |
| Only lower-case true, false and null | {"ok": True, "x": None} |
{"ok": true, "x": null} |
| Something follows the end of the JSON | {"a":1}{"b":2} |
[{"a":1}, {"b":2}] |
A Python dictionary printed with print() fails because of its single quotes and True or None. Use json.dumps() in Python to get valid JSON.
The sizes above the result
Next to the result heading you see “original size → result size”: how much minifying saved, or how much pretty-printing added. Spaces inside text values are left alone; only spacing outside values changes.
Tools that go well with it
- See JSON as a spreadsheet with JSON to XLSX
- To compare two JSON files, format both the same way and paste them into Compare text by line.
- Put an image into a JSON value with Image to Base64
What is a JSON file?
JSON (JavaScript Object Notation) is the standard text format for structured data on the web. It represents objects as {"key": value} pairs and lists as [ … ], with strings, numbers, booleans and null as values. APIs, configuration files and NoSQL databases all use it.
Tabular data in JSON is usually a list of objects — one object per row, with column names as keys — or a list of arrays, one per row.