---
title: "How to Edit a JSON File Online: Free Editor | Prettify"
description: "Edit a .json file in your browser: open it, change a value, add a
  key, remove an item, then download the result. No upload, no install, and
  free."
url: https://prettify.tools/how-to-edit-a-json-file
---

# How to Edit a JSON File

A .json file is plain text, so any editor can open it, but a plain text editor will not warn you when you break it. This guide shows how to open a JSON file, make the common changes safely, check that it still parses, and save the result.

## What editing a JSON file involves

Editing a JSON file means changing its text without breaking its syntax. One misplaced comma makes the whole file unreadable to the program that loads it. The safest method is to edit in a tool that parses the file as you work.

Prettify gives you two ways to do that. The tree view changes one value or one key name at a time. The raw view changes the text itself, which you need for adding and removing things. Both start from the same document.

## Which view to use for which change

Each common change has a best place to make it. Using the right view keeps the syntax valid and saves time, because the tree writes the commas and quotes for you. This list matches each change to the view.

- Fix a value: Tree view. Double-click the value, type the new one, and press Enter.
- Rename a key: Tree view. Double-click the key and type the new name. The editor refuses an empty name or one that already exists.
- Add a key: Raw view. Select Edit, type the new line, and select Save.
- Remove an item from a list: Raw view. Delete its line, and fix the comma on the line above.
- Change the same text in many places: search and replace. Press Cmd+H (Mac) or Ctrl+H (Windows, Linux).
- Remove a key with a query: jq, in the editor toolbar. This is a Pro tool, and free users get one free try per day.

## How to edit a JSON file

Start with the box on this page. It runs in your browser and takes documents up to 512 KB. For a larger file, skip the box and drop the file on the editor.

1. Open the file in a text editor and copy its contents, then paste them into the box at the top of this page.
2. Check the result panel. It shows the formatted JSON, or the line and column of an error.
3. Select Open in full editor. The button reads Fix it in the editor when the JSON has an error.
4. To change a value, double-click it in the Tree view, type the new value, and press Enter.
5. To add a key or remove an item, open the Raw tab and select Edit.
6. Change the text. The status line shows Valid JSON or the first error as you type.
7. Select Save, or press Cmd+Enter (Mac) or Ctrl+Enter (Windows, Linux). Save is refused while the text does not parse.
8. Select Download in the toolbar to save the edited file.

## Worked example: update a settings file

Say a settings file has a port stored as a string, a debug flag that must be off, and an origin you want to remove. You also need a new timeout key.

In the Tree view, double-click "8080" and type 8080 without quotes, so it becomes a number. Double-click true and type false. Then open the Raw view, select Edit, add the timeout line, and delete the staging line together with the comma after the line above it. Select Save.

```
Before
{
  "appName": "inventory",
  "port": "8080",
  "debug": true,
  "allowedOrigins": [
    "http://localhost:3000",
    "http://staging.example.com"
  ]
}

After
{
  "appName": "inventory",
  "port": 8080,
  "debug": false,
  "timeout": 30,
  "allowedOrigins": [
    "http://localhost:3000"
  ]
}
```

## Watch the commas

Commas cause most hand-edit errors. A missing comma between two items shows an error, and Save is refused until you add it. A leftover comma after the last item is different. The editor accepts it as JSONC, and Download writes strict JSON, so the comma is gone from the saved file.

The tree view avoids the problem, because it writes the commas for you. Use it whenever the change is a value or a key name.

## Edit a config file that has comments

Files such as tsconfig.json and VS Code settings allow comments. The editor opens them and shows a note that the comments were ignored, so you can still edit the values.

Be careful when you save. The first tree edit rewrites the document as plain JSON. Copy Formatted and Download also write plain JSON, so the comments do not reach the saved file. If the comments matter, keep your original file and make the change there by hand, using the editor to find the right line.

## Save the edited file

In the browser, Download saves a .json file to your downloads folder. The name comes from the document, so rename it if you need to. Copy Formatted puts the text on your clipboard, so you can paste it into the original file in your own editor.

On the desktop app, Download and Save As in the File menu both open a native save dialog, so you pick the location. Save As uses Cmd+Shift+S on Mac and Ctrl+Shift+S on Windows and Linux. Either way, the output is two-space indented JSON, whatever the style of the original file.

## Frequently asked questions

### What program opens a .json file?

Any text editor can, because JSON is plain text. A JSON editor parses the file while you type. It tells you the moment an edit makes the file invalid.

### How do I edit a JSON file without breaking it?

Change values and key names in the Tree view, which writes the syntax for you. For other changes, use the Raw view and watch the status line. It shows Valid JSON or the first error, and Save is refused while the text does not parse.

### Will editing change the formatting of my file?

Yes. A tree edit, Copy Formatted, and Download all write two-space indented JSON, so a file that used tabs or four spaces comes out re-indented. Key order stays the same. Expect a larger diff in version control the first time.

### How do I put the edited file back where it was?

The browser cannot overwrite your original. Download the result, then replace the old file yourself, or paste the copied text into it. The desktop app asks where to write the file.

### What if the file is too large to open?

Skip the box on this page and open the file in the editor. It parses a document of 1 MB or more in a background worker. On the desktop app, a single file over 100 MB does not open.

### Is my file uploaded when I edit it?

No. The browser reads the file from your disk into the tab, and the file on disk changes only when you replace it with your download.

## Related tools

- [JSON Editor Online](https://prettify.tools/json-editor)
- [JSON Formatter: Prettify and Pretty Print JSON](https://prettify.tools/json-formatter)
- [JSON Viewer with Tree, Table, and Diagram Views](https://prettify.tools/json-viewer)
- [JSON Validator](https://prettify.tools/json-validator)
- [JSON Syntax Checker](https://prettify.tools/json-syntax-checker)
- [JSON to CSV Converter](https://prettify.tools/json-to-csv)

## Structured data

```json
{
  "@context": "https://schema.org",
  "@type": "SoftwareApplication",
  "name": "Prettify",
  "url": "https://prettify.tools",
  "description": "Multi-format data viewer, editor, and query engine for JSON, YAML, CSV, XML, Mermaid, Markdown, MDX, HTML, and SVG",
  "applicationCategory": "DeveloperApplication",
  "operatingSystem": "Web, macOS, Windows, Linux",
  "offers": [
    {
      "@type": "Offer",
      "price": "0",
      "priceCurrency": "USD",
      "description": "Free tier with core features"
    },
    {
      "@type": "Offer",
      "price": "19.99",
      "priceCurrency": "USD",
      "description": "Pro: lifetime access to all features"
    }
  ],
  "publisher": {
    "@id": "https://prettify.tools/#organization"
  }
}
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "@id": "https://prettify.tools/#organization",
  "name": "Prettify",
  "legalName": "Off Leash Labs",
  "url": "https://prettify.tools/",
  "logo": {
    "@type": "ImageObject",
    "url": "https://prettify.tools/icon-512.png",
    "width": 512,
    "height": 512
  },
  "contactPoint": {
    "@type": "ContactPoint",
    "contactType": "customer support",
    "email": "offleashlabs@gmail.com",
    "availableLanguage": "English"
  }
}
{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "WebPage",
      "@id": "https://prettify.tools/how-to-edit-a-json-file",
      "url": "https://prettify.tools/how-to-edit-a-json-file",
      "name": "How to Edit a JSON File Online: Free Editor | Prettify",
      "description": "Edit a .json file in your browser: open it, change a value, add a key, remove an item, then download the result. No upload, no install, and free.",
      "isPartOf": {
        "@type": "WebSite",
        "name": "Prettify",
        "url": "https://prettify.tools"
      }
    },
    {
      "@type": "FAQPage",
      "mainEntity": [
        {
          "@type": "Question",
          "name": "What program opens a .json file?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Any text editor can, because JSON is plain text. A JSON editor parses the file while you type. It tells you the moment an edit makes the file invalid."
          }
        },
        {
          "@type": "Question",
          "name": "How do I edit a JSON file without breaking it?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Change values and key names in the Tree view, which writes the syntax for you. For other changes, use the Raw view and watch the status line. It shows Valid JSON or the first error, and Save is refused while the text does not parse."
          }
        },
        {
          "@type": "Question",
          "name": "Will editing change the formatting of my file?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Yes. A tree edit, Copy Formatted, and Download all write two-space indented JSON, so a file that used tabs or four spaces comes out re-indented. Key order stays the same. Expect a larger diff in version control the first time."
          }
        },
        {
          "@type": "Question",
          "name": "How do I put the edited file back where it was?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "The browser cannot overwrite your original. Download the result, then replace the old file yourself, or paste the copied text into it. The desktop app asks where to write the file."
          }
        },
        {
          "@type": "Question",
          "name": "What if the file is too large to open?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Skip the box on this page and open the file in the editor. It parses a document of 1 MB or more in a background worker. On the desktop app, a single file over 100 MB does not open."
          }
        },
        {
          "@type": "Question",
          "name": "Is my file uploaded when I edit it?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "No. The browser reads the file from your disk into the tab, and the file on disk changes only when you replace it with your download."
          }
        }
      ]
    }
  ]
}
```
