How do I fix JSON errors and make it readable?

When an API response or configuration will not parse, first separate a syntax error from text that is merely hard to read. Use the examples below to fix the input and choose your next tool.

Published and maintained by Utilook

Which tool should you open first?

Formatting parses input it can already read and prints it again with indentation. Syntax validation asks whether the text follows JSON grammar. Schema validation checks separate data rules, such as required fields, value types, or an API contract.

For example, {"age":"unknown"} is valid JSON syntax, but an application expecting a numeric age can still reject it. Neither a formatted result nor a syntax pass proves that the data meets those rules.

Which tool should you open first?
Your situationWhat to choose or check
A comma or quote error is likelyFind the syntax error, correct it, and validate again.JSON Validator
Valid JSON is packed into one unreadable lineApply indentation with the Formatter. This sends the input to the Utilook server.JSON Formatter
Syntax passes but your application rejects the dataCheck required fields, types, and business rules with a separate schema or application validator. These two tools do not perform those checks.

Enough JSON grammar to spot common mistakes

Objects contain name–value pairs in braces; arrays contain values in brackets. Property names and strings need double quotes. A colon separates a name from its value, and commas separate entries. Numbers, true, false, and null are also values.

Standard JSON has no comments or trailing commas, and single quotes cannot delimit strings. A JavaScript object literal pasted into a JSON field often fails for one of these reasons.

Trailing comma

Incorrect

{"name":"Utilook",}

Corrected

{"name":"Utilook"}

Single quotes

Incorrect

{'name':'Utilook'}

Corrected

{"name":"Utilook"}

A practical order for fixing an error

The reported position is where the parser noticed a problem, not necessarily where the mistake began. A missing comma or bracket may only become obvious at the next token.

  1. Check syntax with JSON Validator first.
  2. If it shows a line and column, inspect that character and the quote, comma, or bracket just before it. Otherwise use the parser message to inspect the surrounding structure.
  3. Correct the syntax and check again. Once it passes, use JSON Formatter to reveal nested structure.
  4. If your application requires particular fields or types, run a separate JSON Schema or application-level check.

Utilook's tools use different parsers and processing locations

JSON Validator runs JSON.parse in your browser. It does not send your JSON to the server. After a successful check, it sends only a tool-use count request without the input.

JSON Formatter sends the input to the Utilook server, where it is parsed and printed with two- or four-space indentation. This feature does not save the input or result to a database, but you should consider that server transfer before submitting sensitive content. Optional key sorting changes object-key order, and re-serialization can alter the original notation.

NaN, Infinity, and -Infinity are not JSON values under RFC 8259 and the Formatter now rejects them. A syntactically valid number such as 1e400 can still exceed the server's finite floating-point range and receive a separate range error. Use the browser Validator first when locating syntax errors; formatting success does not validate a JSON Schema or application rules.

Reproduced results and failure conditions

Nested data versus a syntax error

Purpose
Decide whether the input can be formatted before organizing it.
Input
{"items":[{"ok":true},null,2]}
{"name":"Utilook",}
Conditions
Local server API and actual Validator in Chrome 157. Formatter: two spaces, key sorting off. Tool implementation baseline b39fba9.
Observed result
First input: Validator passes; Formatter HTTP 200
{
  "items": [
    {
      "ok": true
    },
    null,
    2
  ]
}
Trailing comma: Validator error; Formatter HTTP 422 / invalid_json
Interpretation
The Formatter does not repair invalid syntax. The regression also checks that failure does not leave a prior successful output available to copy.
Limits and failure conditions
Syntax success does not check required fields or business rules. Parser error locations can vary between browsers.
Next action
Fix the comma, validate again, then apply a separate schema or application check when needed.

Nonstandard constants and a large exponent are different failures

Input
{"value":NaN}
{"value":Infinity}
{"n":1e400}
Conditions
Identical inputs in the real browser Validator and server Formatter API.
Observed result
NaN / Infinity: both tools reject
1e400: Validator syntax pass; Formatter number_out_of_range
Interpretation
NaN and Infinity are not standard JSON values. The spelling 1e400 follows number grammar but exceeds the server's finite floating-point range. Chrome's JSON.parse also produces Infinity internally; the Validator displays syntax status, not parsed numeric values.
Limits and failure conditions
Grammar, numeric range and safe precision are separate questions. A browser syntax pass is not a guarantee of a finite usable number.
Next action
Check the receiving system's numeric range and consider contract-appropriate strings for identifiers or very large numbers.

Information lost through large integers and duplicate keys

Input
{"n":9007199254740993}
{"x":1,"x":2}
Conditions
Actual Chrome 157 JSON.parse compared with the Python server parser.
Observed result
Large integer: Formatter retains 9007199254740993
Browser internal parsed value: 9007199254740992
Duplicate key: syntax passes; both retain only x=2
Interpretation
The Validator does not reprint the parsed value or change the original text. Reusing that JavaScript parsing method for later calculations can nevertheless lose precision. Formatting duplicate keys discards earlier values.
Limits and failure conditions
The Formatter is not a source-preserving editor for original numeric notation or duplicate fields. Other receivers can handle duplicates differently.
Next action
Keep the original, remove duplicate keys, and confirm that the destination handles large integers without loss.

Put it into practice

References

Verification scope and change record

Published and maintained by Utilook · Example checked:

Utilook's tool implementation and the added examples were compared using code, automated browsers and the stated environments. Live network observations and fixtures are identified separately. This date does not represent verification of the entire site, legal compliance or operational logs.

  • This revision adds inputs, conditions, observed results, interpretation, limits and next actions while preserving existing explanations and samples.
Report an error or unclear explanation