Data

JSON Formatter

Paste, upload, or edit JSON directly in a code editor that validates, highlights, and pinpoints errors in real time. Valid JSON is automatically formatted when pasted or uploaded; messy snippets can be repaired; and you can format, minify, sort keys, escape to a string, unescape from a string, and expand nested JSON strings with one click. Fold summaries, JSON Path, fullscreen mode, and display options make large payloads easier to inspect. Everything runs locally in your browser, so your data never leaves your device.

  • Automatically formats valid JSON on paste or upload into a readable 2-space layout
  • Validates as you type and shows the exact error position; click the error status to jump to the line and column
  • Supports formatting, minifying, key sorting, escaping, unescaping, nested JSON expansion, and smart repair
  • Fold objects and arrays; folded arrays show 5 elements, folded objects show 10 keys, while expanded JSON stays clean
  • Shows the JSON Path for the current cursor position in the status bar, with one-click path copy
  • Toggle line numbers, fold controls, line wrapping, active-line highlighting, and fullscreen mode as needed
  • Fully local processing: payloads, tokens, configs, and logs are not uploaded to a server
tools/JSON Formatter
Loading the editor
8%
The code editor is a one-time download and is cached for the rest of your visit.
Waiting for input
JSON commands

Overview

This is more than a JSON pretty-printer. It brings editing, formatting, repair, folding, path inspection, copying, and file handling into one focused workspace for debugging APIs, reading logs, cleaning up configs, and reviewing complex payloads.

  1. 01

    Auto-format on paste and upload

    When pasted text or an uploaded file is valid JSON, the editor automatically turns it into a readable 2-space format. Plain text, partial snippets, or temporarily invalid content are left untouched so your in-progress edits are not disrupted.

  2. 02

    Real-time validation with error jumping

    The editor reparses as you type. Valid input shows a clear success state; invalid input shows the line and column, highlights the area near the error, and lets you jump there by clicking the error status.

  3. 03

    Smart repair for almost-JSON

    Try repair attempts strict JSON, escaped JSON strings, Python-style booleans and nulls, jsonrepair, and combined repair paths. It is useful for logs, console output, and snippets copied from code that look like JSON but are not quite valid.

  4. 04

    Format, minify, and sort keys

    Format rewrites the current JSON for readability, Minify compacts it to one line, and Sort keys recursively sorts object keys to make diffs, reviews, and fixtures more stable. Sorting rewrites the editor text, so copy the original first if you need to preserve the original order.

  5. 05

    Escape and unescape JSON strings

    Escape converts the current JSON into a JSON string, which is useful for logs, config fields, or code strings. Unescape turns a JSON string back into structured JSON, making double-encoded payloads easier to read.

  6. 06

    Expand nested JSON strings

    If a field value is itself a JSON string, such as a log field like payload: "{...}", Expand nested can turn those strings back into objects or arrays so you do not have to copy each value into another tool manually.

  7. 07

    IDE-like fold summaries

    Expanded JSON stays uncluttered with no extra count badges. When folded, arrays show summaries like 5 elements and objects show summaries like 10 keys, making the size of each branch easy to scan.

  8. 08

    JSON Path status bar

    The status bar shows the JSON Path for the cursor position, such as $.data.users[0].name. Click it to copy the path for documentation, field references, backend discussions, or test assertions.

  9. 09

    Configurable editor display

    Display options let you toggle line numbers, fold controls, line wrapping, and active-line highlighting. Large payloads can be inspected in fullscreen mode to reduce surrounding UI noise.

  10. 10

    Fully local, no upload required

    Parsing, formatting, repairing, folding, copying, file reading, and download generation all happen inside your browser. Production responses, internal configs, tokens, and logs are not sent to a server.

How to use

The usual flow is simple: paste or upload, check the parse status, repair if needed, then format, fold, copy, or download.

  1. 01

    Paste JSON, an API response, a webhook payload, a log snippet, or a config file into the editor. You can also use Upload file to read a local JSON or text file.

  2. 02

    If the content is valid JSON, it is automatically formatted on paste or upload. If it is not valid JSON, the original text is preserved and the parse status is shown.

  3. 03

    If you see Parse failed, click the error status to jump to the line and column. If the input came from logs, a JS console, or Python-style output, try Try repair.

  4. 04

    Use Format, Minify, and Sort keys to clean up the structure. Use Escape, Unescape, and Expand nested for stringified or double-encoded JSON.

  5. 05

    For large payloads, start with Collapse all, then expand only the objects and arrays you need. Fold summaries show element and key counts.

  6. 06

    Check the JSON Path in the status bar and click it to copy the current field path. Switch to fullscreen when you need more room.

  7. 07

    Finally, copy the formatted version, copy the compact version, or use Download to save the current JSON as a file.

Details

These features cover the most common JSON debugging problems: invalid syntax, deeply nested structures, hard-to-locate fields, stringified data, unstable diffs, and sensitive payloads that should stay local.

  • Valid JSON is formatted automatically after paste, so you do not need to press Format first.
  • Uploaded JSON files are automatically formatted when possible; if parsing fails, the original text is preserved for repair.
  • Parse status updates in real time, with line and column details plus click-to-jump error navigation.
  • Formatted JSON can be minified to one line for request bodies, environment variables, log fields, or fixtures.
  • Object keys can be sorted recursively to make API responses, config files, and test data easier to diff.
  • JSON can be converted into an escaped string, and escaped JSON strings can be restored to structured JSON.
  • Nested JSON strings can be expanded automatically, which is common in log pipelines and message queues.
  • Folded arrays show element counts and folded objects show key counts; expanded JSON stays free of extra badges.
  • The bottom status bar shows the current line and column, JSON Path, parse status, and character count so large structures are easier to navigate.
  • Line numbers, fold controls, line wrapping, and active-line highlighting can be toggled on demand.
  • Deep payloads can be inspected in fullscreen, and the current formatted content can be downloaded.

Use cases

Use this page whenever you have JSON that you need to read, fix, organize, and copy out quickly.

  1. Debug API responses

    Paste REST, GraphQL, or RPC responses, format them, fold unrelated branches, and check whether a field is missing, null, the wrong type, or wrapped in an extra layer.

  2. Inspect webhooks and event payloads

    Review events from Stripe, GitHub, Slack, payment systems, or analytics platforms and quickly find the event type, id, timestamp, signature fields, and business payload.

  3. Recover JSON fragments from logs

    Paste JSON strings, escaped payloads, or almost-JSON fragments from logs, then use unescape, nested expansion, and repair to turn them back into readable structures.

  4. Clean up config files

    Organize tsconfig, package.json, ESLint config, feature flags, CDN rules, and app settings. Formatting makes them easier to review, while key sorting makes diffs cleaner.

  5. Prepare request bodies

    Before using Postman, curl, fetch, or test scripts, edit the request body here, validate the JSON syntax in real time, and copy either the compact or formatted version.

  6. Check AI tool calls and prompt fixtures

    Inspect model tool-call arguments, agent intermediate state, or prompt fixtures to catch extra commas, missing braces, or escaped fields before automation breaks.

  7. Refine decoded JWT or Base64 payloads

    Paste JSON decoded from JWTs, Base64, or other tools, then continue formatting, folding, copying paths, and sorting fields.

  8. Prepare test fixtures and seed data

    Turn exported sample data into consistently indented, stably sorted JSON before adding it to fixtures, Storybook, mock servers, or documentation.

  9. Incident response and postmortems

    Format production responses, error context, and log payloads into readable form without uploading them to a third-party site, then use them in tickets or postmortems.

See also

Once the JSON parses successfully, the next step is often format conversion. Send it to JSON Converter to convert it into YAML, XML, CSV, TOML, JavaScript object syntax, or PHP arrays with format-specific options. If the data is already tabular, continue with CSV Tools to detect delimiters, preview tables, rename columns, and export CSV / TSV / JSON / Markdown. If the JSON is wrapped in log prefixes or repeated text, use Text Replace first to remove the outer text, then come back here to validate the cleaned JSON.If those JSON fields came from a SQL query result, or the same log includes the source query, send the SQL to SQL Formatter to re-indent it and locate syntax issues before returning here to inspect the JSON structure.When you already have two versions of a JSON document and want to see exactly what changed, hand them to JSON Diff for a git-style side-by-side or unified diff, a structural change list keyed by JSON Path, and word-level highlighting for long string changes.When you want to extract fields by path, test a JSONPath expression, or run a jq filter after formatting, continue with the JSONPath & jq Evaluator .

JSON rules worth remembering

Many parse failures are not tool bugs; the input is simply not strict JSON. These differences show up often in logs, console output, and copied config snippets.

  1. Keys must use double quotes

    Standard JSON requires keys like {"name": "Alice"}. {name: "Alice"} is a JavaScript object literal, not strict JSON. Fix it manually or try Try repair.

  2. Strings must use double quotes

    JSON does not allow single-quoted strings. {"name": "Alice"} is valid; {'name': 'Alice'} is not strict JSON. Logs and Python or JavaScript output often contain this style.

  3. Trailing commas are not allowed

    Objects and arrays cannot have a comma after the last item. Many JavaScript formatters allow trailing commas, but strict JSON parsers reject them.

  4. Standard JSON has no comments

    // and /* */ belong to JSONC, JSON5, or JavaScript syntax, not standard JSON. Some editors accept them, but APIs and parsers may not.

  5. JSON has only six value types

    A JSON value can only be an object, array, string, number, boolean, or null. undefined, functions, Date objects, and NaN are not JSON values.

  6. Formatting preserves structure; sorting changes text order

    Formatting and minifying only change whitespace; the data structure remains the same. Key sorting changes the textual order of object keys, which is useful for diffs but should be avoided if you need to preserve the original order.

Best practices

The larger and deeper the JSON, the more useful a consistent review routine becomes. These habits reduce misreads and repeated work.

  • Check the parse status right after pasting. Valid JSON is auto-formatted; failed parses can be opened directly at the error position.
  • For content copied from logs, consoles, or backend exceptions, try Try repair and Unescape early. These sources are often not strict JSON.
  • When a string field contains another JSON document, use Expand nested instead of manually copying the value into another tool over and over.
  • For large payloads, start with Collapse all, then expand only the branches you need by field name or JSON Path. Fold summaries help you spot unusual object or array sizes.
  • Before committing fixtures or reviewing diffs, format the JSON and sort keys when appropriate. Future changes become more stable and easier to review.
  • Use Copy compact for HTTP bodies, environment variables, message queues, and one-line log fields. Use Copy formatted for documentation, tickets, and postmortems.
  • Redact production data before sharing it. This tool does not upload your data, but anything you paste into tickets, chats, docs, or recordings may be shared elsewhere.

Limitations

This tool focuses on JSON syntax, structure, and display. It does not replace schema validation, business-rule validation, diff tools, or data transformation pipelines.

  • It validates JSON syntax, but it does not know whether fields satisfy your business rules. Required fields, enum values, range checks, and cross-field constraints still belong in Zod, Ajv, OpenAPI, or backend validators.
  • It is not a full JSON5 or JSONC editor. Try repair handles common paste issues, but it does not guarantee support for every extended syntax feature.
  • It is not a JSON diff tool. Sorting keys can make diffs more stable, but side-by-side comparison should still be handled by a dedicated diff tool.
  • It does not automatically change the business meaning of field values. Renaming keys, bulk type conversion, field removal, and structural mapping are better handled by converters, scripts, or text replacement tools.
  • Very large payloads in the tens of megabytes may slow down the browser. Consider extracting the relevant subtree or using command-line or streaming tools for analysis.
  • All processing is local, but local safety still depends on your device, browser extensions, screen sharing, and where you copy the data afterward.

FAQ

Common questions about auto-formatting, smart repair, fold summaries, JSON Path, privacy, and large payloads.

Will my JSON be uploaded to a server?

No. Parsing, formatting, minifying, repairing, folding, file reading, copying, and downloading all happen in the current browser tab. DevKitLab does not send your payload to a server.

Why does my JSON get formatted as soon as I paste it?

If the pasted content is valid JSON, the editor formats it with 2-space indentation so it is readable immediately. If it is not valid JSON, the original text is preserved to avoid rewriting partial input or work in progress.

What does Try repair do?

It tries multiple parsing paths: strict JSON, escaped JSON strings, Python-style True / False / None, jsonrepair, and combined repair. If one succeeds, the result is formatted and written back to the editor.

Why does something that looks like JSON still fail to parse?

Common causes include unquoted keys, single-quoted strings, trailing commas, comments, incomplete brackets, or input that is actually a JSON string rather than a JSON object. Try repair or unescape it.

Do formatting and minifying change the data?

No. Formatting and minifying only change whitespace, indentation, and line breaks. The JSON structure stays the same. Key sorting changes the textual order of object keys, but not their values.

When should I use escape or unescape?

Use Escape when you need to put JSON inside another JSON field, a log string, or a code string. Use Unescape when you receive stringified JSON such as "{\"a\":1}" and want to restore it to an object.

When is Expand nested useful?

Use it when a field value is itself a JSON string, such as a log payload, a message queue body, or nested webhook parameter. It recursively expands object and array strings into real structures.

What do elements and keys mean after folding?

A folded array shows its element count, such as 5 elements. A folded object shows its key count, such as 10 keys. Expanded JSON does not show extra count badges, keeping the editor clean.

What is JSON Path useful for?

JSON Path precisely describes the field at the current cursor position, such as $.data.users[0].email. You can copy it for tickets, docs, log notes, API discussions, or test assertions.

Does sorting keys change the original order?

Yes. It rewrites the order of object keys in the editor. This is useful for stable diffs and cleaner configs, but copy the original first if you need to preserve its order.

Can it handle large JSON files?

Typical API responses, webhooks, config files, and payloads of a few megabytes usually work well. Tens of megabytes can slow down the browser, so consider extracting the relevant subtree or using command-line tools.

Does it support JSONC, JSON5, or NDJSON?

The editor validates strict JSON. JSONC, JSON5, and NDJSON are not native formats here. Some common JSON5 / JSONC-style issues can be handled by Try repair; NDJSON should be split into one JSON document per line first.

Is there a fullscreen shortcut?

Yes. When the viewer is focused or your mouse is over it, press F to switch between window mode and fullscreen mode.

Related tools

Continue your JSON workflow with the data tools: convert to other formats, work with CSV tables, or clean up wrapper text around a payload.