Skip to content

Practical guide

How to Format and Validate JSON

JSON is a text format for representing data. Indentation makes nested objects and arrays easier to inspect, while parsing checks that the text follows JSON syntax. These are related tasks, but neither proves that the data matches an application-specific schema.

Start with valid JSON syntax

JSON property names and string values use double quotes. Objects use braces, arrays use brackets, and commas separate items. The final item in an object or array must not have a trailing comma.

Numbers, strings, booleans, null, arrays, and objects are valid JSON values. Comments, undefined, functions, and single-quoted strings are JavaScript syntax, not JSON.

{
  "name": "Ada",
  "active": true,
  "roles": ["editor", "reviewer"]
}

Format first, then inspect the structure

A formatter parses the input and writes it with consistent indentation. If parsing fails, read the reported syntax error and inspect the nearby punctuation, quotes, and brackets before trying again.

After formatting, check whether keys and values are present and typed as expected. A JSON formatter can detect invalid syntax; it cannot know whether a field such as "email" is required by your own application.

Use a safe workflow for sensitive data

This site’s JSON formatter runs in the browser and does not send its text to an Every Kit processing server. Avoid pasting secrets into any online service unless you have checked how that service handles data.

Keep the original input before changing it, and verify any edited configuration in the system that will consume it. Formatting changes whitespace, not the meaning of valid JSON data.