Back to blog

How to Create a .JSON File in Notepad

Jul 3, 20263 min read

JSON is plain text with strict rules. Notepad can write it just fine. The part people get wrong is the syntax, not the tool. Get the structure right, and saving the file is the easy part.

What is a JSON file?

JSON stands for JavaScript Object Notation. It stores data as key-value pairs inside curly braces, with support for nested objects and arrays. Apps, APIs, and config files use it because it's lightweight and every major language can read it.

A basic JSON file looks like this:

{
  "name": "John",
  "age": 28,
  "isActive": true,
  "skills": ["writing", "editing"]
}

Step-by-step: Create a JSON file in Notepad

Step 1: Open Notepad

Open Notepad on your computer, or use a free online notepad from any browser.

Step 2: Start with an opening brace

Every JSON file starts with { for an object or [ for an array. Most files start with an object.

Step 3: Add your keys and values

Write each key in double quotes, followed by a colon, followed by the value. Separate each pair with a comma.

{
  "title": "Sample File",
  "version": 1
}

Step 4: Close the file properly

Match every opening brace or bracket with a closing one. The last key-value pair in an object or array does not get a trailing comma.

Step 5: Save with a .json extension

Go to File, then Save As. Choose All Files in the "Save as type" dropdown. Name the file with a .json extension, for example data.json. Saving without changing this dropdown leaves you with a .txt file that won't be read as JSON.

Step 6: Validate before you use it

Paste the file into a JSON editor to confirm it's valid before you use it in a script or app. A quick check here saves you from debugging later.

JSON Syntax Rules To Remember

  • Double quotes only. Keys and string values need double quotes, not single quotes.

  • No trailing commas. Nothing follows the last item in an object or array.

  • No comments. Standard JSON does not support // or /* */ notes inside the file.

  • Booleans are lowercase. Use true and false, not True or FALSE.

  • Numbers don't need quotes. Write 28, not "28", unless the value is meant to be text.

Common Errors and How to Avoid Them

Problem: Missing comma between key-value pairs. Fix: Every pair except the last one needs a comma after it.

Problem: Mismatched brackets or braces. Fix: Count your {} and [] pairs. A validator will point to the exact line where they don't match.

Problem: Unescaped quotes inside a string. Fix: Escape internal quotes with a backslash, for example "He said \"hello\"".

Problem: A key without quotes. Fix: Every key must be wrapped in double quotes, even simple ones like id or name.

Conclusion

A JSON file is just text that follows a strict format. Write your keys and values with double quotes, match your brackets, skip the trailing comma, and save it with a .json extension. Run it through a validator once before you use it, and you're set.

Related posts