What JSON files are and why you might need to edit one
A JSON file is a plain text file that stores data in a format computers can read easily. JSON stands for JavaScript Object Notation. You'll find JSON files in configuration settings for programs, in data exports from websites, in API responses, and in many modern applications. They use curly braces, square brackets, and quotation marks to organize information into a structure that looks like this:
If you need to change a setting, update a value, or fix broken data in a JSON file, you don't need special software — any text editor will work. The key is understanding the format well enough to make changes without breaking the file's structure.
Key Takeaways
- JSON files are plain text and can be opened in any text editor like Notepad, VS Code, or Sublime Text.
- JSON uses curly braces for objects and square brackets for arrays, and every opening bracket must have a closing one.
- The most common mistake is forgetting a comma between items or adding one after the last item in a list.
- After editing, you can check your work using an online JSON validator to catch formatting errors before saving.
- Always save a backup copy of the original file before making changes, in case something goes wrong.
Opening a JSON file in a text editor
Right-click the JSON file on your computer. Select "Open with" and choose a text editor. On Windows, Notepad is built in and will work. On Mac, use TextEdit (but switch to plain text mode first under Format menu). On any system, you can use free editors like VS Code, Sublime Text, or Notepad++, which are better for spotting errors because they color-code different parts of the file.
Do not open JSON files in Microsoft Word or Google Docs — these programs add hidden formatting that will break the file. Stick to plain text editors only.
Understanding JSON structure so you don't break it
JSON has three basic building blocks: objects (wrapped in curly braces { }), arrays (wrapped in square brackets [ ]), and key-value pairs (a name followed by a colon and a value). Every opening bracket needs a closing one. Every key and every text value must be wrapped in quotation marks. Numbers and true/false values do not need quotes.
Here's what correct JSON looks like:
{ "name": "Sarah", "age": 28, "active": true, "hobbies": ["reading", "hiking", "coding"] }
Notice that "name", "age", "active", and "hobbies" are all in quotes because they are keys. The values "Sarah" and the items in the hobbies array are in quotes because they are text. The number 28 and the word true are not in quotes. After each item except the last one in a group, there is a comma.
Common mistakes to avoid when editing
The most frequent error is forgetting a comma between items. If you add a new line to a JSON file, make sure there's a comma at the end of the previous line (unless it's the last item). The second most common mistake is adding a comma after the last item in a list or object — that will break the file.
Another mistake is deleting a closing bracket by accident. Count your opening and closing brackets before you save. If you see an error message when you try to use the file, the problem is usually a missing comma, a missing bracket, or a quotation mark that wasn't closed properly.
Text values must always be in straight quotation marks (" "), not curly quotes (" "). Some text editors use curly quotes by default, so check your editor settings if you're pasting text into a JSON file.
Checking your work with a JSON validator
After you finish editing, paste your JSON into an online validator before you save and use the file. Search for "JSON validator" in your browser — sites like jsonlint.com and jsonchecker.com are free and will tell you exactly where the error is if something is wrong. They'll show you the line number and what the problem is, which saves time hunting through the file yourself.
Copy the entire contents of your edited file, paste it into the validator, and click the validate button. If it says "valid JSON", you're safe to save. If it shows an error, the validator will point you to the exact location of the problem.
Saving your changes without losing the original
Before you save over the original file, make a backup. Right-click the JSON file, select "Copy", then right-click in the same folder and select "Paste". Rename the copy to something like "filename-backup.json". Now if something goes wrong, you have the original to go back to.
After you've validated your changes and made a backup, save the file. In most text editors, use Ctrl+S (Windows) or Command+S (Mac). Make sure the file still ends with .json — if your editor adds .txt or changes the extension, the program that uses this file won't recognize it.
Editing JSON in different situations
If you're editing a configuration file for a program, the program usually needs to be closed first. If the program is running and reading that file, your changes might not take effect or the program might overwrite your edits when it closes. Close the program, make your changes, validate them, then restart the program.
If you're editing a JSON file that was exported from a website or app, check whether that app will let you re-import it. Some apps expect the file to be in a specific format and won't accept edits. Test by importing a small change first before you make major edits.
Frequently Asked Questions
What's the difference between JSON and other file formats like XML or CSV?
JSON uses brackets and colons to show structure, XML uses tags like HTML, and CSV is just comma-separated values in rows. JSON is easier to read and edit by hand. All three are plain text, so any text editor works for all of them.
Can I edit JSON on my phone?
Yes, but it's harder because you can't see as much of the file at once. Apps like Jota+ (Android) and Textastic (iOS) are text editors that color-code JSON and make it easier to spot errors. For anything longer than a few lines, a computer is much easier.
What if I delete something important by accident?
That's why you made a backup. Close the file without saving, then open your backup copy and start over. If you already saved the broken version, you can undo the last save in most text editors by pressing Ctrl+Z or Command+Z immediately after opening the file.
Do I need to know programming to edit JSON?
No. You only need to understand that brackets must match, commas go between items, and text values need quotes. If you follow those three rules and use a validator, you can edit JSON without any programming knowledge.
Why does my program say the JSON file is invalid when the validator says it's correct?
The program might expect specific keys or values that aren't there, or it might need the file in a particular order. The validator only checks that the JSON format is correct, not that the content matches what the program wants. Check the program's documentation for what keys and values it requires.