JSON Formatter

Format, validate and minify JSON instantly.

Paste your JSON

data.json
Ready. Paste JSON and choose an action.

Your JSON is processed in your browser. Nothing is uploaded to BroBroGo.

FAQ

Is my JSON uploaded?

No. The formatter runs in your browser and does not upload your JSON.

What does minify do?

Minify removes unnecessary spaces and line breaks while keeping the same JSON data.

Processing and Validating JSON Data

This tool formats, validates, and minifies JSON data. It allows you to paste JSON directly into the input area, open local files, and perform structural operations such as adjusting indentation levels, stripping unnecessary whitespace, or sorting keys.

Your JSON is processed in your browser, and nothing is uploaded to BroBroGo. This local execution model ensures that your data remains entirely within your local environment during formatting, validation, or minification.

The tool supports direct text input as well as file uploads. You can open a .json or .txt file by clicking "Open file" or by dragging and dropping the file directly into the interface. To ensure successful processing, files must meet the following requirements:

  • Format and Encoding: Only .json or .txt files are supported, and they must be UTF-8 encoded.
  • Size Limits: The maximum input size the tool can process is 10 MiB. If a file exceeds this limit, the tool displays the message "File is too large — the limit is ‹limit›.". If the input text itself exceeds the processing threshold, the interface shows "Input is larger than ‹limit›, which is more than this tool can process.".

For files that do not meet these criteria, the tool will display specific error messages:

  • "Unsupported file type — choose a .json or .txt file."
  • "This file is not UTF-8 text, so it cannot be opened here."
  • "Could not read this file. Try choosing it again."

Formatting and Minifying for Readability and Storage

The tool provides two primary presentation modes for JSON text: formatting for human readability and minifying for compact storage or transmission.

Formatting JSON

Formatting reorganizes nested data structures by applying consistent indentation. You can select your preferred indentation level before running the process. Once formatted, the interface displays "JSON formatted." and updates the "Code" view to show the structured text. The tool also tracks document statistics, displaying the exact count of characters in "Chars", the number of lines in "Lines", and the overall data size in "Size".

Minifying JSON

Minification strips out all non-essential characters—such as spaces, tabs, and line breaks—outside of string values. This reduces the overall payload size for storage or API transmission. When this action is completed, the tool displays "JSON minified.".

Key Sorting

To help compare different JSON payloads, you can use the "Sort keys" button. Hovering over this button displays the tooltip: "Sort object keys recursively in code-point order. Array order never changes.". Sorting object keys alphabetically makes it easier to identify structural differences between two files. After sorting, the tool displays "Keys sorted — array order unchanged. Press Ctrl/Cmd+Z to undo.".

Navigating Complex Structures with the Tree View

For large or deeply nested JSON documents, the "Tree" view provides an interactive, visual representation of the data hierarchy. The root of the hierarchy is represented by the "root" label.

Within the "Tree" view, you can perform several actions:

  • Expand and Collapse: Use "Expand all" or "Collapse all" to open or close all nodes simultaneously. You can also manage individual nodes using the "Expand ‹key›" or "Collapse ‹key›" buttons.
  • Search: Type queries into the search box labeled "Search keys and values". The tool highlights matches and displays your position using "‹current› of ‹total›" or "‹current› of ‹total›+" if the matches are capped. If no matches are found, it displays "No matches". You can navigate results using the "Previous match" and "Next match" buttons.
  • Data Extraction: Right-clicking or opening the "Copy options for ‹key›" menu allows you to extract specific data points. You can select "Copy value", "Copy JSON Pointer", or "Copy JSONPath" to copy the precise path or value to your clipboard. When successful, the tool displays "Copied to clipboard.".

Tree View Limitations and Edge Cases

The tree view requires valid JSON and has rendering limits to prevent browser performance degradation:

  • If the input contains syntax errors, the tree view is disabled and displays "Fix the JSON to view it as a tree.".
  • If the JSON is too large, the tree view displays "This JSON is too large to render as a tree." or "This JSON has too many values to render as a tree.".
  • When expanding a large dataset, the tool caps the render depth and displays "This JSON is too large to expand fully — showing the first ‹count› rows.", along with a "Show ‹count› more…" button.

Identifying and Resolving Syntax Errors

If you input invalid JSON, the tool displays "Invalid JSON" along with the precise location of the issue, formatted as "line ‹line›, column ‹col›". You can click the "Go to error" button to jump directly to the problematic line in the editor.

The tool detects and flags specific syntax violations, including:

  • "Missing comma between items"
  • "Extra comma before the closing bracket"
  • "Object keys must be wrapped in double quotes"
  • "Missing colon after a property name"
  • "A string is missing its closing quote"
  • "The JSON ends too early — it looks truncated"
  • "Unexpected character where a value should be"
  • "This JSON is nested too deeply to process"
  • "Duplicate key ‹key› — remove one before formatting" (the tool flags duplicate keys as errors rather than silently merging or discarding them).

If the validation process takes too long on a complex document, the tool stops and displays "Checking this JSON took too long and was stopped. Try a smaller document.".

Working with Non-Standard and JSON-Like Formats

The tool can detect several common non-standard formats and offers automated repairs to convert them into valid JSON. When a non-standard format is identified, you can click "Preview fix" to open the "Repair preview" window. This window displays the "Original" input side-by-side with the corrected version under "After the fix".

If the document is very large, the tool displays "Preview truncated — the fix affects the whole document.". You can apply the changes by clicking "Apply fix", which displays "Fix applied. Press Ctrl/Cmd+Z to undo.". If the tool cannot resolve the issue, it displays "Could not repair this input automatically.".

The table below outlines the non-standard formats the tool detects, its diagnostic messages, and the corresponding repair actions:

Detected Format Diagnostic Message Repair Action
Markdown Code Fence "This looks like JSON inside a Markdown code fence." "Applying keeps only the JSON inside the fence."
Escaped JSON String "This looks like JSON escaped inside a string." "Applying unescapes the string into plain JSON."
Python Dictionary "This looks like a Python-style dictionary rather than JSON." "Applying rewrites quotes and True/False/None as JSON."
JSON Lines (NDJSON) "This looks like JSON Lines — one value per line." "Applying wraps the lines into one JSON array."
JSONP Callback "This looks like JSON wrapped in a JSONP callback." "Applying removes the callback wrapper."
JSONC (with Comments) "This looks like JSONC — comments or trailing commas. Switch the syntax to JSONC or apply the fix." "Applying removes comments and trailing commas."

For general repairs not covered by these specific categories, the tool uses the action message: "Applying replaces the input with the repaired JSON.". You can also manually switch the "Syntax" selection between "JSON" and "JSONC" depending on your workflow requirements.

Frequently Asked Questions

Is my JSON uploaded?

No. The formatter runs in your browser and does not upload your JSON.

What does minify do?

Minify removes unnecessary spaces and line breaks while keeping the same JSON data.

How does the tool handle duplicate keys in an object?

Unlike some parsers that silently overwrite duplicate keys, this tool flags them as an error, displaying "Duplicate key ‹key› — remove one before formatting" to prevent accidental data loss.

Can I preserve large integers when formatting?

Yes. The tool preserves large integers without loss during formatting and minification operations.