What JSON is and why you edit it
JSON (JavaScript Object Notation) is a text format that stores data in a way computers can read and understand. It looks like a list of pairs — a name followed by a value — wrapped in curly braces or square brackets. You edit JSON files when you need to change settings, add data, or fix configuration mistakes in applications, websites, or software tools.
JSON files are plain text, so you can open and edit them in any text editor. The catch is that JSON has strict rules about punctuation and structure. A missing comma, a misplaced quote, or an extra bracket will break the file and prevent the program from reading it. Learning to spot and fix these mistakes is the main skill you need.
Key Takeaways
- JSON files are plain text and can be edited in any text editor, but the format has strict rules about commas, quotes, and brackets that must be followed exactly.
- The most common mistakes are missing commas between items, forgetting to close brackets or braces, and using single quotes instead of double quotes.
- A JSON validator tool will show you exactly where the error is, which is faster than trying to find it by eye.
- Keep a backup copy of the original file before you edit, so you can restore it if something goes wrong.
- Text editors designed for code, like Visual Studio Code or Notepad++, highlight JSON syntax and catch some errors as you type.
Opening and editing JSON in a text editor
Right-click the JSON file and choose "Open with" (on Windows) or "Open With" (on Mac). Select a text editor from the list — Notepad on Windows or TextEdit on Mac will work, but a code editor is better. If you have Visual Studio Code, Sublime Text, or Notepad++ installed, use one of those instead, because they highlight the structure and make mistakes easier to spot.
Once the file is open, you can edit the text the same way you would in any document. Find the value you want to change and type the new one. If you are adding a new item, remember the rules: separate items with commas, wrap text in double quotes, and make sure every opening bracket or brace has a closing one. Save the file when you are done — use Ctrl+S on Windows or Command+S on Mac.
Understanding JSON structure and common mistakes
JSON has two main containers: curly braces {} for objects (a collection of name-value pairs) and square brackets [] for arrays (a list of items). Inside an object, each name and value are separated by a colon, and items are separated by commas. Inside an array, items are separated by commas. Text values must be wrapped in double quotes; numbers and true/false do not need quotes.
The most common mistakes are forgetting a comma after an item, leaving off a closing bracket or brace, using single quotes instead of double quotes, or putting a comma after the last item in a list (which is invalid). Here is a broken example and the fix:
Broken: {"name": "John", "age": 30,} (comma after the last item)
Fixed: {"name": "John", "age": 30}
Using a JSON validator to find errors
A JSON validator is a tool that reads your file and tells you exactly what is wrong and where. Open a web browser and search for "JSON validator" — you will find free tools like JSONLint, JSON Formatter, or the validator built into Visual Studio Code. Copy your JSON text, paste it into the validator, and click the button to check it. If there is an error, the validator will show you the line number and describe the problem.
This is much faster than reading through the file yourself, especially if it is long. Once you know what the error is, go back to your text editor, find that line, and fix it. Then paste the corrected text back into the validator to confirm it is now valid. When the validator says "valid JSON" or shows no errors, your file is ready to use.
Editing JSON in code editors with built-in help
Visual Studio Code and similar code editors highlight JSON syntax with colors and automatically indent your code as you type. They also show you when a bracket or brace is not closed — usually with a red squiggly line or a warning. This catches many mistakes before you even save the file.
To use this feature, open your JSON file in Visual Studio Code. The editor will recognize the .json file extension and explore JSON formatting automatically. As you type, mismatched brackets will be underlined. You can also hover over a bracket to see its matching pair highlighted. This visual feedback makes it much harder to make mistakes and much easier to fix them when you do.
Backing up and testing your changes
Before you edit a JSON file that your process uses, make a copy of the original. Right-click the file, choose "Copy", and paste it in the same folder with a name like "config-backup.json" or "settings-original.json". If your edit breaks something, you can restore the original file and try again.
After you save your edited JSON file, test it by running the process or tool that uses it. If the program reads the file without errors, your JSON is valid and your changes worked. If the program crashes or shows an error, the JSON is broken — go back to your backup, compare the two files, and find what you changed wrong. A validator can help you spot the difference.
Frequently Asked Questions
Can I use Notepad to edit JSON files?
Yes, Notepad works fine for editing JSON because JSON is plain text. However, Notepad does not highlight syntax or warn you about errors, so you are more likely to make mistakes. A code editor like Visual Studio Code or Notepad++ is better because it shows you the structure and catches problems as you type.
What does "invalid JSON" mean?
Invalid JSON means the file does not follow the format rules — usually a missing comma, an unclosed bracket, or quotes in the wrong place. The program that reads the file will not be able to understand it and will show an error. A JSON validator will tell you exactly what is wrong and where.
Do I need to restart my process after editing a JSON file?
Usually yes. Most applications read the JSON file once when they start up. If you edit the file while the process is running, the changes will not take effect until you close and reopen the process. Some applications check for changes automatically, but it is safer to restart.
Can I edit JSON on my phone?
You can, but it is not recommended. Phones have small screens and limited text editors, which makes it straightforward to make mistakes. If you must edit JSON on a phone, use an app designed for code editing like Dcoder or Quoda, which highlight syntax and help you avoid errors.
What if I accidentally delete part of the JSON file?
If you saved the file, use your backup copy to restore the original. If you did not save yet, close the file without saving and reopen it — the original will still be there. If you saved the broken version, restore from your backup and edit again more carefully.