JSON Formatter & Validator

Paste JSON and instantly check its syntax, beautify or minify it, and visualize it as a tree. Nothing is sent to a server — everything runs in your browser.

Input

How to use

  1. Input: Paste JSON text into the left box, use "Open file" to upload a .json file, or drag a file onto the page.
  2. Format / Minify / Validate: Use the buttons above to apply indentation, strip whitespace, or just check syntax.
  3. Check the result: In the right panel, browse the structure with "Tree view" (expand/collapse), or check the formatted source with "Text view". Errors show exactly which line and column caused the problem.
  4. View as a table: "Table view" shows an array of objects (like an API response) as a spreadsheet. Even if the top level isn't an array, it auto-detects one nested in a property (e.g. {"data": [...]}) and renders that instead.
  5. Convert to TypeScript: Click the "TypeScript" tab to auto-infer interface declarations from your JSON. Identically-shaped nested objects are merged into one interface, and fields missing from some array items are marked optional with ?.
  6. Export: Copy the result to your clipboard or download it as a file (.json for tree/text, .ts for TypeScript, .csv for the table).
  7. Validate against a schema: Click "🛡 Schema validate" to open a JSON Schema input box. "Run validation" checks your JSON against it and lists any violations with their path.

Everything runs inside your browser (JavaScript) — nothing you enter is sent to a server or stored.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight data-interchange format that represents data as key-value pairs. It's easy for humans to read and write, and easy for machines to parse and generate, which is why it's used everywhere — API responses, config files, data storage, and more. JSON has strict syntax rules: strings must be double-quoted, and trailing commas aren't allowed. This tool validates your input against those rules.

Frequently Asked Questions

Is my JSON data sent anywhere?

No. All parsing and formatting happens in JavaScript inside your browser and is never sent to a server.

Why do I get an "Unexpected token" error?

This usually means a string isn't wrapped in double quotes, there's a trailing comma after the last item, or comments are present — all of which violate standard JSON syntax. Check the line/column shown in the error message.

Does this support JSON5 or comments?

This tool only supports standard JSON (RFC 8259). Comments, trailing commas, and single quotes are all flagged as invalid.

Can it handle large JSON files?

Files up to a few MB work fine within your browser's memory limits. For very large files, tree-view rendering can get slow — switch to text view instead.

How is JSON different from XML?

JSON's key-value structure is more compact than XML and parses faster, and most languages can handle it without extra libraries. XML can express more complex document structures (attributes, namespaces, XSD schemas), but at the cost of size and parsing overhead. Most REST APIs today respond with JSON.

Does this validate against a JSON Schema?

Yes. Click "🛡 Schema validate" above to open a JSON Schema input box. It checks a practical subset of common keywords — type, required, properties, items, enum, the min/max family, pattern, oneOf/anyOf/allOf, and more — and lists violations with their path (e.g. $.address.zip). It doesn't implement the full JSON Schema spec (every draft, remote $ref, etc.).

Can I convert JSON straight into TypeScript types?

Yes. Paste an API response or config file into the "TypeScript" tab and it generates interface declarations automatically. Identically-shaped types — like objects inside an array — get merged into one interface, and fields that only appear on some items are marked optional with ?. You can rename the root interface in the input above the output.