A long JSON response is difficult to inspect when everything sits on one line. Formatting makes its structure easier to read, but it does not tell you whether the data is correct for your application. Keep syntax, structure and business meaning as three separate checks.

Use the local JSON formatter

  1. Open the JSON Formatter.
  2. Paste a copy of your JSON into the input. The existing tool handles this in your browser and limits the input to 2 MB.
  3. Choose Pretty print for readable indentation or Minify for compact output.
  4. Select Format JSON. Read any syntax error before changing the data.
  5. Copy or download the result and compare it with the original before using it.

Start with a small example

{
  "business": "Example Studio",
  "services": ["Branding", "Website design"],
  "published": true
}

This illustrative object uses a string, an array and a boolean. The example business is fictional. Each key is enclosed in double quotes, the values use valid JSON syntax and the final item has no trailing comma. Do not add JavaScript comments to a JSON document.

Fix common errors one at a time

  • Single quotes: JSON strings require double quotes. Avoid a global replacement if apostrophes belong inside the text.
  • Trailing commas: remove a comma after the final object member or array item.
  • Unescaped quotes: quotes inside a string need appropriate escaping.
  • Unexpected text: a response containing an HTML error page is not JSON, even if the endpoint was expected to return JSON.

JavaScript's JSON parser throws a syntax error for invalid JSON. Treat that message as a starting point: a missing character earlier in the document can make the parser fail later. Work on a copy and test after each correction.

Valid syntax can still contain the wrong data

A formatted document may be missing a required field, use the wrong units or contain a value that your application rejects. Compare it with the API's documented schema or expected input. Do not change account numbers, dates or amounts merely to make the document parse. The formatter is not a schema validator.

Keep important values safe

Be cautious when reserialising very large numeric identifiers through JavaScript: numbers beyond its safe integer precision can change. Store identifiers as strings when the receiving schema permits it. Compare sensitive numeric output with the original rather than assuming whitespace is the only difference.

Debug without exposing confidential material

Even local processing does not make a shared computer private. Remove passwords, access tokens and customer details before copying examples into support messages or screenshots. Close the workspace when finished. If an integration still fails after syntax corrections, record the endpoint, response status and a redacted sample for your website integration discussion.

Example: finding a JSON typing mistake

Try the sample {"product":"Notebook","price":1200,"available":true}. It is valid because property names use double quotes, the number is unquoted, and true is a JSON boolean. Changing the value to True or adding a trailing comma makes the document invalid.

A formatter can help with indentation and syntax but cannot determine whether your application expects the correct field names or value types. Validate against your application’s schema before using the output in production. Avoid pasting passwords, private tokens or customer records into unfamiliar online services.

Sources and further reading

Turn the next step into a project

Need help with a brand identity, business website or launch assets? Explore SOPIDOTECH services and client projects, or discuss your brief.

Keep learning