Use this practical JSON formatter and validator checklist to pretty-print data, find syntax errors, inspect nested objects, and debug API responses without exposing sensitive information.
Overview
JSON, short for JavaScript Object Notation, is a text format commonly used for API requests and responses, configuration files, logs, and data exchange between applications. It is easy for people to read, but a single missing quote, comma, or closing bracket can make the entire document invalid.
A JSON formatter adds indentation and line breaks so the structure is easier to inspect. A JSON validator checks whether the text follows JSON syntax. These tasks are related but different: formatting improves readability, while validation confirms that a parser can interpret the data. A formatter cannot reliably repair every mistake, so validate the input after making any changes.
For routine work, use this sequence:
- Keep an untouched copy of the original input.
- Remove secrets or use a trusted local tool before pasting data into a browser-based utility.
- Format the JSON to reveal its structure.
- Validate it and record the reported line or position.
- Fix one issue at a time, then validate again.
- Test the corrected payload in the application or API workflow that will consume it.
Checklist by scenario
When you receive a compact or unreadable response
- Confirm that the response is intended to be JSON rather than HTML, plain text, or an error page.
- Paste it into a JSON formatter or format it locally in your editor.
- Check whether the top-level value is an object, array, string, number, boolean, or null.
- Expand nested objects and arrays gradually instead of scanning one long line.
- Compare the visible keys and value types with the API documentation or expected response.
When a validator reports invalid JSON
- Start at the reported line and character, but also inspect the character immediately before it.
- Check for unmatched braces
{}and brackets[]. - Check that every property name uses double quotation marks.
- Remove trailing commas after the final property or array item.
- Replace comments, single quotes, and unquoted values with valid JSON syntax.
- Run the validator after each small correction so the next error is easier to isolate.
When preparing an API request
- Confirm that the request body is sent with the expected content type, commonly
application/json. - Match the API's required property names, nesting, and value types.
- Distinguish between a missing property and a property set to
null; the receiving application may handle them differently. - Check whether identifiers should be strings even when they contain only digits.
- Test the smallest valid payload first, then add optional fields one at a time.
When debugging authentication or configuration data
- Separate syntax problems from authentication problems. Valid JSON can still contain an expired token, incorrect permission, or wrong endpoint.
- Never paste access tokens, passwords, private keys, customer records, or production configuration into an unknown online tool.
- For token-related troubleshooting, use a controlled environment and follow a documented inspection process. The JWT decoding and debugging guide covers safe handling considerations for claims and signatures.
- Redact secrets before creating screenshots, issue reports, or example payloads.
JSON syntax reference
Use this compact reference while reading a validator message or reviewing a payload:
| Element | Valid JSON example | Frequent problem |
|---|---|---|
| Object | {"name":"Sam"} | Missing brace or property name |
| Array | ["red","blue"] | Missing bracket or extra comma |
| String | "status" | Single quotes or an unescaped quote |
| Number | 42 | Text used where a number is required |
| Boolean | true | Using True or "true" unintentionally |
| Null | null | Using NULL or an undefined value |
JSON property names and string values use double quotes. Objects contain comma-separated name-value pairs, while arrays contain comma-separated values. A final item should not be followed by a comma. JSON also does not include comments, although some configuration formats that resemble JSON add their own extensions.
What to double-check
Syntax is not the same as meaning
A document can be valid JSON and still fail an application's requirements. After syntax validation, check the schema or API contract: required fields, allowed values, maximum lengths, date formats, identifier formats, and whether fields may be null. If the service provides schema validation, use it as a second layer rather than relying only on a basic formatter.
Types can change the result
These values are not interchangeable:
{
"enabled": true,
"retryCount": 3,
"accountId": "3"
}
The first value is a boolean, the second is a number, and the third is a string. A parser may accept all three, but the receiving application can apply different rules to each type.
Escaping matters
Quotes inside a string must be escaped, as must certain control characters. A line break copied directly into a string can invalidate the document. When JSON is embedded inside another language, such as a shell command or source-code string, account for both JSON escaping and the outer language's escaping rules.
Inspect the raw response
If an API response appears invalid, inspect its status code, headers, and unprocessed body. A proxy, login page, server error, or rate-limit response may have replaced the expected JSON. Formatting the body can make the response readable, but it does not explain why the wrong content was returned.
Common mistakes
- Confusing JavaScript with JSON: JavaScript may allow comments, single-quoted strings, or trailing commas in some contexts; strict JSON does not.
- Fixing only the first error: parsers often stop at the first point where they cannot continue. Later messages may appear after that issue is corrected.
- Editing minified data without a copy: keep the original response so you can compare changes and reproduce the problem.
- Trusting a green validation result too much: syntactic validity does not prove that the payload matches a schema, endpoint, or business rule.
- Sharing production data casually: redaction can fail when secrets are nested, encoded, or stored in unexpected fields. Prefer local validation for confidential data.
- Ignoring encoding and transport details: valid JSON can still be corrupted by an incorrect character encoding, truncated response, or improperly constructed request body.
When to revisit
Return to this checklist whenever an API changes, a configuration file is copied between environments, or a previously working request begins returning an unexpected result. It is especially useful before a deployment, after changing authentication settings, and when adding new nested fields to a payload.
Tool workflows also change. Recheck which formatter or validator your team uses when browser extensions, editor plugins, command-line utilities, or hosted developer tools are replaced. Confirm where processing occurs, how input is retained, and whether the tool is appropriate for confidential data. For operational changes around a website or service, pair JSON checks with the relevant website launch preflight checklist or review your hosting and deployment requirements.
Before you close a JSON debugging task, save a minimal reproducible example, document the expected shape, and record the final validation and application test results. That small habit turns a one-time fix into a reusable reference for the next response, configuration change, or deployment.