DevTools Hub

JSON Formatter & Validator

Validate, pretty-print, minify and sort JSON, right in your browser.

Input
Output

Guide

About the JSON Formatter

What it does

  • Format re-indents JSON so nested objects and arrays are easy to read.
  • Minify strips all optional whitespace, producing the smallest valid JSON for APIs or storage.
  • Validate checks the syntax and reports the line and column of the first error.
  • Sort keys orders object keys alphabetically at every level, which makes two JSON documents much easier to compare.

The most common JSON errors

JSON is stricter than JavaScript object syntax. Nearly every validation error comes from one of these:

  • Trailing commas: {"a": 1,} is invalid; remove the last comma.
  • Single quotes: strings and keys must use double quotes, so {'a': 'b'} fails.
  • Unquoted keys: {a: 1} works in JavaScript but not in JSON.
  • Comments: // and /* */ are not allowed in standard JSON.
  • Special values: undefined, NaN and Infinity have no JSON representation; use null.

Private by design

API responses often contain tokens, emails or customer data. This formatter uses the browser's built-in JSON.parse and JSON.stringify, so your data is never uploaded, logged or stored.

Frequently asked questions

Is there a size limit?

Only your browser's memory. Files of several megabytes format in well under a second on a typical laptop.

Does sorting keys change the meaning of my JSON?

No. Object key order has no meaning in JSON, so sorted output is equivalent. Array order is always preserved.

Why do large numbers change after formatting?

JavaScript stores numbers as 64-bit floats, so integers above 9,007,199,254,740,991 lose precision when parsed. If you need exact large IDs, send them as strings.