JSON Validator
JSON Validator
JSON (JavaScript Object Notation) is the universal data exchange format for web APIs. Valid JSON is critical - a single misplaced comma or missing quote will cause a parse error in every language.
Conversion Formula
JSON.parse() follows the RFC 8259 spec. It rejects trailing commas, comments, single quotes, undefined, and NaN/Infinity values - all legal in JavaScript but not in JSON.
Step-by-Step Examples
{"name":"Alice","age":30} = Valid JSON - formatted with indentation
Well-formed JSON object
{name: 'Alice'} = Invalid: Unexpected token n
Unquoted key and single quotes are not valid JSON
History
JSON was created by Douglas Crockford around 2001 and standardized as RFC 4627 in 2006. It replaced XML as the dominant API data format by 2010 due to its simplicity and native JavaScript support.
Common Use Cases
- API response debugging
- Configuration file validation
- Data import/export checks
- Schema development
Frequently Asked Questions
What are the most common JSON syntax errors?
Trailing commas ({"a":1,}), single quotes instead of double quotes, unquoted keys, and missing quotes around string values are the most frequent mistakes.
What is the difference between JSON and a JavaScript object?
JSON is a text format with strict rules: keys must be double-quoted strings, values can only be string, number, object, array, true, false, or null. JavaScript objects allow unquoted keys, single quotes, functions, and comments.
Why does my API return invalid JSON?
Common causes: the server returned an error page (HTML) instead of JSON, a BOM character at the start, or a trailing comment/comma from non-standard JSON.