Skip to main content

JSON Formatter & Validator

Pretty-print, minify, validate, and inspect strict RFC 8259 JSON inside an isolated browser frame. Keeps 64-bit IDs, 1.0 decimals, key order, and duplicate keys exactly as typed.

By Lasita Engineering TeamLast reviewed: Examples verified by hand & automated test suite

How to Use This Formatter

  1. Click inside the Input JSON panel and paste a payload, or click Open file to load a local .json file (up to 10 MB).
  2. Choose 2 spaces, 4 spaces, Tabs, or Minify. Leave Keys: Keep Order on to preserve exact property order, or toggle Sort A–Z (case-insensitive) when comparing configs.
  3. If validation fails, check the exact Line and Column banner. Review the listed repairs before clicking Apply fixes.
  4. Switch the output panel to Tree to copy any canonical JSONPath, or use the JSONPath tab (for example, $.users[*].name or $..['key']).

Why Lossless Formatting Matters (Verified Examples)

Production API responses frequently include 64-bit Snowflake IDs, decimal flags like 1.0, or accidentally duplicated object keys from upstream proxies. Standard JSON.parse formatters silently alter all three:

// Input payload
{"z":12345678901234567890,"a":1.0,"dup":1,"dup":2}

// Typical JSON.parse() formatter (DATA CORRUPTED):
// {"z": 12345678901234567000, "a": 1, "dup": 2}

// Lasita lossless formatter (EXACT DATA PRESERVED + duplicate warning):
{
  "z": 12345678901234567890,
  "a": 1.0,
  "dup": 1,
  "dup": 2
}

Common JSON Mistakes That Break Production Parsers

  • Trailing commas: {"a": 1,} works in JavaScript literals but fails strict RFC 8259 JSON parsers.
  • Single, curly quotes, or unquoted keys: Every property name and string value must use ASCII double quotes ("key").
  • Comments: Standard JSON forbids // and /* */ comments; removed comments are replaced with a space so adjacent tokens like [1/**/2] never silently fuse into [12].
  • Unescaped control characters: Raw newlines inside string values must be escaped as \n.

Limits & Edge Cases

  • Maximum file size is capped at 10 MB and maximum nesting depth at 512 levels so malformed inputs never hang your browser.
  • Outputs larger than 200 KB display a fast preview while Copy output and Download .json always use the complete formatted file.
  • Simple JSONPath supports $, .key, ['key'] (including keys containing ]), [0], [*], and recursive descent .. . Every match is counted, the first 200 are shown, and a search that is too big stops early and says so.

Frequently Asked Questions

Why does a normal JSON formatter corrupt large numbers like 12345678901234567890?

Most browser tools call JavaScript JSON.parse() and JSON.stringify(), which convert every number to an IEEE-754 64-bit float. Any integer past 9,007,199,254,740,991 loses precision (12345678901234567890 becomes 12345678901234567000) and decimals like 1.0 collapse to 1. Lasita uses a lossless tokenizer and AST formatter that preserves exact digits, trailing decimals, key order, and repeated keys.

Are my pasted JSON payloads uploaded or visible to ad scripts?

No. The JSON editor runs inside an isolated cross-origin browser frame with connect-src none and no third-party scripts. Scripts on this outer content page cannot access the iframe DOM or what you paste.

What broken JSON issues can the repair preview fix?

The repair analyzer detects trailing commas, single or curly quotes (including apostrophes inside them), unquoted keys, // and /* */ comments, Python/JS literals (True, False, None, NaN), raw line breaks in strings, and most missing commas. Changes are listed with their exact original line and column before applying (for very broken files, the first 5,000).

What happens if I paste a very large or deeply nested JSON file?

Parsing and formatting run off the main thread in a reused Web Worker with a Cancel button. Large outputs preview the first 200 KB in the text box while Copy and Download preserve the full file. Text over 10 MB or deeper than 512 levels stop gracefully.

Read the full engineering reference: Practical Reference for Everyday Developer Data: JSON, Regex, Unix Timestamps, Base64 & WCAG Contrast →