Recent Players

Arjun S. earned ₹480

Play Now

*Illustrative player activity

Formatting and validating JSON, and finding the one bad character

Four mistakes cause almost every JSON parse error. Trailing commas top the list.

Open JSON Formatter on ToolHubAll tools

A JSON formatter does two jobs. It pretty-prints a minified blob so a human can read it, and it validates the syntax so you find out exactly where the structure is broken instead of staring at an API error.

Almost every JSON parse failure is one of four things: a trailing comma after the last item, single quotes instead of double, an unquoted key, or an unescaped character inside a string. JSON is stricter than JavaScript object literals, which is why code that looks fine to a developer fails to parse. The formatter is in the ToolHub developer section.

JSON Formatter: the facts that matter

FunctionsFormat, validate, minify
Error reportingPosition of the parse failure
Top cause of failureTrailing comma
CommentsNot valid in JSON, despite what editors allow
PrivacyRuns in the browser; nothing sent to a server

How to do it, step by step

  1. 1Open the JSON formatter in ToolHub and paste your JSON.
  2. 2Format it. If it is invalid, you get an error position instead.
  3. 3Go to the reported position, then look at the character just before it. The real problem is usually one character earlier than the error points to.
  4. 4Check the four usual suspects: trailing comma, single quotes, unquoted key, unescaped character.
  5. 5Minify before sending JSON over the wire, and format when you need to read it.

Three things worth knowing

Common problems, solved

Where to run it

This tool is part of the ToolHub tool library, a library of over 1,000 browser-based tools covering PDF, image, video, audio, text and developer work. Everything runs in the browser and none of it needs an account.

ToolHub is built by codaiman.com, an AI-first software company in Ahmedabad. Related to this page: Web development custom websites and web apps in react, next.js and typescript, including pwas and api work.

JSON Formatter, in the browser: no install, no sign-up, no upload queue. Part of the ToolHub library from CodeAiMan.

Open ToolHub
Download IN7 Free — ₹777 Bonus