JSON Formatter Hub
This page collects the most common questions developers, testers, and students ask about JSON โ from basic syntax rules to debugging specific error messages, exporting data, and using the JSON Formatter Hub tools effectively. Each answer links to deeper guides where relevant.
JSON stands for JavaScript Object Notation. Despite the name, JSON is completely language-independent and is used in virtually every programming language and platform โ Python, Java, C#, Ruby, Go, PHP, Swift, and many others all have native JSON parsing support.
JSON is used primarily for data interchange โ passing structured data between a client and a server, between two services, or between a program and a configuration file. Common uses include:
package.json, tsconfig.json, settings.json, etc.)For a full introduction, see What Is JSON?
JSON supports exactly six value types:
"hello"42, 3.14, -7true or false (lowercase, no quotes)null (lowercase, represents the absence of a value){ }[ ]Notice that dates, regular expressions, and functions are not native JSON types โ dates are typically encoded as ISO 8601 strings like "2024-01-15T10:30:00Z".
No. The JSON specification (ECMA-404 and RFC 8259) does not include comment syntax. Adding // or /* */ to a JSON file will make it invalid and cause parse errors. If you need annotation in a config file, some tools support JSON5 or JSONC (JSON with Comments) as an extension, but those are not standard JSON and cannot be parsed by JSON.parse() directly.
{"name": "Alice"}, not {name: "Alice"}// or /* */)07 is invalid; use 7\" for a double quote, \\ for a backslash, \n for a newline
Yes. Key names and string values are case-sensitive. "Name" and "name" are different keys. The JSON keywords true, false, and null must be lowercase โ True or NULL will cause a parse error.
The JSON specification says duplicate keys produce "undefined" behaviour โ it is technically not prohibited, but the result depends on the parser. Most parsers will silently accept the input and use the last value for a given key. This is a source of subtle bugs: if you have {"id": 1, "id": 2}, some parsers will give you 1, others will give you 2. Best practice is to never use duplicate keys.
"Unexpected token" typically means the parser encountered a character it did not expect at that position. The most common causes are:
{"a": 1,}{'a': 1}{a: 1}// this is a commentundefined as a value (not valid JSON; use null instead)Paste the JSON into the formatter and the validator will highlight the exact line. The Auto-fix button can repair trailing commas, missing commas, and unquoted keys automatically. See Common JSON Errors for a full reference.
This means the JSON string ended before the structure was complete โ typically because a closing brace } or bracket ] is missing. It can also happen if you accidentally copy only part of a JSON response. Count your opening and closing braces/brackets, or use the tree view to see where the structure ends.
JavaScript object literals allow single quotes, unquoted keys, trailing commas, and comments. None of these are valid in strict JSON. If your data originated as a JavaScript object literal (e.g., you copied it from source code or a Node.js REPL), it needs to be converted to valid JSON: add double quotes around keys, switch single quotes to double quotes, remove trailing commas and comments.
Paste your JSON into the editor on the formatter page and click Format. The tool will add proper indentation (2 spaces by default), validate the input, and display any errors. You can also press Ctrl+Enter (or Cmd+Enter on Mac) as a keyboard shortcut.
Click Auto-fix to apply automatic repairs to your JSON. The engine handles: trailing commas after the last key or element, missing commas between elements, single-quoted strings (converts them to double-quoted), and unquoted object keys. After auto-fix, the formatter validates the result โ if there are still errors (e.g., a missing bracket), you will see them highlighted.
Format your JSON first, then click Export/Download โ Export as CSV. This works best when your JSON is a top-level array of objects with consistent keys โ for example:
[
{"name": "Alice", "age": 30, "city": "London"},
{"name": "Bob", "age": 25, "city": "Paris"}
]
Each object becomes a row, and keys become column headers. Nested objects are flattened during export.
Yes. Click Load from URL, enter a valid http:// or https:// URL that returns JSON, and the tool fetches and displays it. The target server must send a Access-Control-Allow-Origin header (CORS). Most public APIs do. If you get a CORS error, copy the response body from your browser's DevTools Network tab and paste it manually.
No. All processing โ formatting, validation, tree rendering, auto-fix, export โ runs in JavaScript in your browser. Nothing is sent to any server. You can confirm this by opening your browser's DevTools Network tab while using the tool; no requests are made when you paste and format JSON.
Use the JSON Compare tool. Paste the first JSON in the left panel and the second in the right panel, then click Compare. The tool highlights added, removed, and changed keys with colour coding. For a workflow guide, see How to Compare JSON.
JSON is the better choice for most modern APIs and applications because it is more compact, maps directly to programming language data structures, and is easier to read by humans. XML is still widely used in enterprise systems, SOAP web services, document formats (like Office Open XML), and some configuration standards. If you are building a new REST API, use JSON. If you are integrating with a legacy enterprise system, you may not have a choice. See JSON vs XML for a detailed comparison.
JSONL (also called JSON Lines or newline-delimited JSON) is a format where each line in a text file is a valid, standalone JSON object. It is commonly used for log files and large data exports because you can stream or process one line at a time without loading the entire file. A JSONL file is not the same as a JSON array โ each line is independent and does not have commas between lines.
JSON5 is an unofficial extension of JSON that allows comments, single-quoted strings, trailing commas, unquoted keys, and a few other relaxations. It is used in some configuration formats (for example, TypeScript's tsconfig.json accepts JSON5). Standard JSON parsers like JSON.parse() will reject JSON5 content โ you need a dedicated JSON5 parser to read it.