Skip to content

JSON Editor

Edit JSON source, check syntax, and download your changes. Switch to the tree view to inspect nested values.

Runs in your browser Free, no sign-up
Loading tool workspace...

What is JSON Editor?

This JSON editor is a simple in-browser editor for JSON text. Paste or write JSON, change keys and values directly, and then click Beautify JSON to re-indent everything with 2 spaces, or Minify JSON to collapse it to a single compact line. The result replaces the text in the editor, so you can keep editing.

If the JSON is invalid when you beautify or minify, the editor shows the parser's error message and leaves your text untouched, so you can fix the problem and try again. It is ideal for quick edits to config files, request bodies and test fixtures when you do not want to open an IDE.

How to use JSON Editor

  1. Paste or type JSON into the editor.
  2. Edit keys and values directly in the text.
  3. Click Beautify JSON to re-indent it with 2 spaces, or Minify JSON to put it on one line.
  4. If an error appears, fix the reported problem and click the button again.
  5. Copy the result when you are done.

Key features

  • Plain-text JSON editing in the browser
  • Beautify JSON with 2-space indentation in place
  • Minify JSON to a single line in place
  • Clear syntax error messages that leave your text unchanged
  • No sign-up and no uploads

Common use cases

  • Making quick edits to JSON config files
  • Adjusting API request bodies before sending them
  • Editing test fixtures and mock data
  • Toggling between readable and compact JSON while editing
  • Fixing small mistakes in hand-written JSON

Technical details & standards

Beautify and Minify parse the text with the browser's JSON.parse and re-serialize it with JSON.stringify, using 2-space indentation or none. Because the text is re-serialized, formatting is normalized: whitespace is rewritten and escape sequences are output in their standard form, while keys, values and their order are preserved.

The editor accepts strict JSON only (RFC 8259), so comments and trailing commas are reported as errors. As with any JavaScript-based JSON tool, integers above 9007199254740991 lose precision when re-serialized. Everything stays in your browser.

Edit a JSON file in code or on the command line

For repeatable edits, such as changing one value in many files, read the JSON, change it and write it back. These snippets change a user's name in data.json.

Python

import json

with open("data.json", encoding="utf-8") as f:
    data = json.load(f)

data["users"][0]["name"] = "Grace"

with open("data.json", "w", encoding="utf-8") as f:
    json.dump(data, f, indent=2, ensure_ascii=False)

JavaScript (Node.js)

const fs = require("fs");

const data = JSON.parse(fs.readFileSync("data.json", "utf8"));
data.users[0].role = "admin";
fs.writeFileSync("data.json", JSON.stringify(data, null, 2) + "\n");

jq (terminal)

jq '.users[0].name = "Linus"' data.json > data.new.json

jq writes to standard output, so save to a new file and then replace the original.

Frequently asked questions

How do I edit a JSON file online?

Open the file in any text editor, copy its contents, paste them into this editor and make your changes. Click Beautify JSON to check the syntax and tidy the indentation, then copy the result back into your file and save it. To edit the .json file in place, VS Code highlights syntax errors as you type and Format Document (Shift+Alt+F) re-indents it.

Why won't my JSON beautify?

It contains a syntax error, such as a trailing comma, single quotes or a comment. The error message tells you what the parser found; fix it and click Beautify again.

Does beautifying change my data?

No. Keys, values and their order stay the same; only whitespace and the formatting of escape sequences are normalized. The one exception, as in all JavaScript-based tools, is integers larger than 2^53 − 1, which lose precision.

Can I edit JSON with comments?

Standard JSON does not allow comments, so the editor reports them as errors. Remove them before formatting, or use the LLM JSON Fixer, which strips comments automatically.

Is this a JSON file editor?

Yes. Open a .json file or paste its contents, change keys and values as text, check that no syntax error is shown, then copy or download the result. It edits the text of the file, so for structural changes across many files use the Python, Node.js or jq snippets below.

How do I edit a JSON file on my computer?

Open it in this editor with Open file, or drop it onto the editor, make your changes, check that no syntax error is shown, then download the result. Offline, any plain-text editor works, such as VS Code, Notepad or TextEdit in plain-text mode; avoid word processors, which add formatting and curly quotes that break JSON.

Is my data safe?

When you request a URL, your browser sends the request directly to that destination. CodeUnpack does not proxy the request.

Does it work offline?

Once the page has loaded, you can work with local input offline. Loading a URL requires a connection.

More formatters & viewers tools

View all