What a JSON file is and why you need one
A JSON file is a plain text document that stores data in a format computers can read and organize. JSON stands for JavaScript Object Notation. It uses curly brackets, square brackets, and quotation marks to structure information so that different programs can understand it — whether you're moving data between applications, storing settings, or sharing information with someone else.
You create a JSON file the same way you create any text file: in a basic text editor, with a specific naming convention at the end. The file itself is just text. What makes it JSON is the way you format the content inside and the .json extension you add to the filename.
Most people create JSON files because they need to import data into a program, export data from one system to another, or store structured information in a way that multiple applications can read. If you've never done this before, the process is straightforward once you understand the basic rules of how JSON is formatted.
Key Takeaways
- JSON files are plain text documents you create in any text editor, formatted with specific brackets and quotation marks, and saved with a .json extension.
- JSON data uses curly brackets for objects, square brackets for lists, and requires quotation marks around text values but not around numbers.
- The most common mistake is forgetting a comma between items or adding one after the last item, which breaks the file.
- You can test whether your JSON file is correctly formatted by opening it in a JSON validator or trying to import it into the program that needs it.
- Notepad on Windows and TextEdit on Mac work for creating JSON files, but saving as plain text is essential — never use Word or similar programs.
Understanding JSON structure and syntax
JSON uses a simple set of rules. Data is organized into objects (wrapped in curly brackets: {}) and arrays (wrapped in square brackets: []). Inside an object, you write pairs of information: a name (called a key) and a value. The key and value are separated by a colon, and each pair is separated from the next by a comma.
Here is a basic example:
{ "name": "Sarah", "age": 28, "city": "Portland" }
Notice that text values (like "Sarah" and "Portland") are in quotation marks, but numbers (like 28) are not. If you have multiple objects or entries, you put them in square brackets to create an array:
[ { "name": "Sarah", "age": 28 }, { "name": "Marcus", "age": 35 } ]
The most important rule: every item except the last one in a list needs a comma after it. The last item does not. This is where most people make mistakes.
Creating a JSON file in Notepad (Windows)
Step 1: Open Notepad. Press the Windows key, type "Notepad", and click the result. Do not use Word or any other word processor — they add invisible formatting that breaks JSON files.
Step 2: Type or paste your JSON content. Use the examples above as a template, or write your own following the bracket and comma rules. Make sure text values are in quotation marks and numbers are not.
Step 3: Go to File menu and click Save As. A dialog box will open.
Step 4: In the "File name" field, type a name followed by .json — for example, contacts.json or data.json. The .json extension tells your computer this is a JSON file.
Step 5: In the "Save as type" dropdown, select "All Files" instead of "Text Documents". This prevents Notepad from adding a .txt extension automatically.
Step 6: Choose where you want to save the file and click Save. Your JSON file is now created.
Creating a JSON file on Mac using TextEdit
Step 1: Open TextEdit. Press Command + Space, type "TextEdit", and press Enter.
Step 2: Go to the Format menu and select "Make Plain Text". This is essential — if you skip this step, TextEdit will add formatting that corrupts the JSON file.
Step 3: Type or paste your JSON content into the document. Follow the same bracket and comma rules as described above.
Step 4: Go to File and click Save. A dialog box will open.
Step 5: In the filename field, type your name with the .json extension — for example, contacts.json. TextEdit will ask if you want to use the .json extension instead of .txt. Click "Use .json".
Step 6: Choose your location and click Save. Your JSON file is created and ready to use.
Checking your JSON file for errors
After you save your JSON file, you should verify that it is formatted correctly. A single missing comma or misplaced bracket will prevent programs from reading it. The easiest way to check is to use a free online JSON validator.
Go to a site like jsonlint.com or jsonformatter.org. Copy and paste the contents of your JSON file into the text box, and click the validate or check button. If your file is correct, you will see a message saying it is valid. If there is an error, the validator will tell you which line has the problem and what is wrong.
Another way to test is to try importing the file into the program that needs it. If the program rejects it with an error message, open your file again in your text editor, find the line mentioned in the error, and look for missing commas, extra commas, or mismatched brackets.
Common mistakes when creating JSON files
The most frequent error is adding a comma after the last item in a list or object. Remember: commas go between items, not after the final one. If you have three entries and put a comma after the third, the file will not validate.
Another common mistake is forgetting quotation marks around text values. Numbers do not need quotes, but any text — names, addresses, descriptions — must be wrapped in quotation marks. If you write name: Sarah instead of name: "Sarah", the file will fail.
Using the wrong type of quotation marks also breaks JSON files. Use straight quotation marks (" "), not curly or smart quotes (" "). If you copy and paste from Word or a web page, the quotes may automatically convert to the wrong type. Paste into Notepad or TextEdit first, then copy from there into your JSON file.
Finally, do not save your file as a Word document or rich text file. Always save as plain text with the .json extension. If you see .txt at the end of your filename, you saved it as the wrong type.
Using your JSON file with other programs
Once your JSON file is created and validated, you can import it into applications that accept JSON data. Many programs have an import or upload feature where you can select your file. Some applications let you drag and drop the JSON file directly into them.
If a program rejects your file, check the error message carefully. It may tell you that a specific field is missing or formatted incorrectly. Go back to your JSON file, compare it to the program's requirements or documentation, and make adjustments. Save the file again and try importing once more.
You can also share JSON files with other people. They can open them in any text editor to read the contents, or import them into programs that support JSON. Because JSON is a standard format, it works across different operating systems and applications.
Frequently Asked Questions
Can I create a JSON file on my phone?
Yes, but it is more difficult than on a computer. You need a text editor app that saves as plain text — not a word processor. Apps like Jotterpad (Android) or 1Doc-Word Processor (iOS) can create plain text files. Save with the .json extension. On most phones, it is easier to create the file on a computer and transfer it.
What if my JSON file has a lot of data?
The process is the same regardless of file size. Notepad and TextEdit can handle large files. If your file becomes very large (over 100 MB), you may want to use a dedicated code editor like Visual Studio Code, which is free and handles large files more smoothly. The formatting rules remain identical.
Do I need special software to open a JSON file?
No. You can open any JSON file in Notepad, TextEdit, or any text editor. You can also open it in a web browser — just drag the file into your browser window. If you want to edit it, use a text editor. If you want to use the data, import it into the program designed to read it.
What is the difference between JSON and CSV?
CSV (comma-separated values) is simpler and stores data in rows and columns, like a spreadsheet. JSON is more flexible and can store nested data and different data types in one file. Use CSV for simple lists; use JSON when your data has a more complex structure or needs to be read by multiple different programs.
Can I edit a JSON file after I create it?
Yes. Open it in your text editor, make changes, and save. Remember to keep the bracket and comma rules intact. After editing, validate the file again to make sure you did not introduce errors.