Skip to content
New: 17 free file converters that never upload your files
File Converter Guides

How to Create a JSON File: Notepad, Mac, VS Code, Python and a Free Converter

How to create JSON file content fast: use our free converter, Notepad, TextEdit, VS Code or Python, plus fixes for the errors that break JSON files.

How to create JSON file: LeadCanal guide cover
On this page
  1. What does a valid JSON file look like?
  2. Method 1: Create a JSON file from text with our free converter
  3. How to create JSON file in Windows with Notepad
  4. How do you create a JSON file on a Mac?
  5. How to make a JSON file in VS Code
  6. How to create a JSON file in Python
  7. Can you create a JSON file from Excel?
  8. Which method should you use?
  9. Can you create a JSON file on iPhone or Android?
  10. Why our converter keeps your file on your device
  11. Common JSON file errors and how to fix them
  12. Frequently asked questions
  13. Conclusion: key takeaways
  14. Editorial policy
  15. Content transparency
  16. About the author

To create a JSON file, write your data as keys and values inside curly braces, using double quotes, then save the plain text with a .json extension. If you already have the data as text, the fastest route is our free TXT to JSON converter: paste a list, key: value pairs or a table and download a valid .json file in seconds. If you want to know how to create JSON file content by hand instead, Notepad, TextEdit, VS Code and Python all work, and we cover each one below.

We build these converters and handle client data files every day, so this guide focuses on the mistakes that actually break JSON: curly quotes, trailing commas and hidden .txt extensions.

Quick answer: A JSON file is plain text that follows JSON syntax and ends in .json.

  • Fastest: paste your text into the free text to JSON tool, click Convert to JSON and download the file. Nothing is uploaded.
  • Windows: type the JSON in Notepad, choose Save as, set “Save as type” to All files and name it data.json.
  • Mac: use TextEdit in plain text mode with smart quotes off, then save as data.json.
  • Developers: create the file in VS Code or write it with Python’s json.dump().
  • Golden rules: double quotes only, no trailing commas, no comments, UTF-8 encoding.

Free LeadCanal tools for this guide

Check and fix it yourself in a few seconds, no signup needed.

TXT to JSON →TXT to CSV →CSV splitter →Email extractor →

What does a valid JSON file look like?

Before you create anything, it helps to see the target. Here is a small, valid JSON file describing one contact:

{
  "name": "Ana Silva",
  "company": "Northwind",
  "age": 31,
  "active": true,
  "tags": ["lead", "webinar"],
  "manager": null
}

Every key is a string in double quotes. Values can be one of six types, and JSON has no other data types, so dates and phone numbers are stored as strings.

JSON type Example Notes
String "Ana Silva" Double quotes only. Escape inner quotes as \"
Number 31, 4.5, -2 No leading zeros, so keep ZIP codes like 02134 as strings
Boolean true, false Lowercase, no quotes
Null null Lowercase, means “no value”
Object {"key": "value"} Key and value pairs separated by commas
Array ["a", "b"] An ordered list of any of the types above

The full grammar is short and lives in RFC 8259, the official JSON standard. It also says JSON exchanged between systems should be encoded as UTF-8.

Method 1: Create a JSON file from text with our free converter

Most people do not start with an empty file. They have a list of names, a block of settings or a spreadsheet export, and they need it as JSON. Typing all those brackets and quotes by hand is slow and error-prone, which is why we built the free TXT to JSON converter.

  1. Open the tool and paste your text, or drop one or more .txt, .csv, .tsv, .log, .ndjson or .jsonl files.
  2. Check “Read the text as”. Leave Detect automatically on, or force A list of lines, Key: value pairs, Table with a header row, or JSON (format it).
  3. Pick the indentation: 2 spaces, 4 spaces, tabs or minified.
  4. Keep “Turn numbers, true/false and null into JSON types” ticked if you want real numbers and booleans instead of strings.
  5. Click Convert to JSON, then copy the result or download the .json file. Several files at once come back as a ZIP.

How your text maps to JSON:

  • One item per line becomes an array: ["apple", "banana", "cherry"].
  • Lines like name: Ana or name=Ana become an object. Separate records with a blank line and you get an array of objects.
  • A header row plus comma, tab, semicolon or pipe separated rows becomes an array of objects, one per row.
  • One JSON object per line (NDJSON) is merged into a single valid array.

The converter is careful with values that only look like numbers. ZIP codes with a leading zero and IDs longer than 15 digits stay as text, so nothing gets silently changed. Duplicate keys in a block become an array instead of overwriting each other.

A worked example from our own workflow

A client sends us a plain text list of domains to exclude from a cold email campaign, one per line. Our list-cleaning script reads its settings from JSON, so we paste the list into the converter, leave auto-detect on, and it reads the text as a list of lines. We download exclude-domains.json, drop it next to the script and run the job. No hand-typed quotes, no missing commas, and the file never leaves the laptop.

How to create JSON file in Windows with Notepad

Notepad is already on every Windows PC and is fine for small files.

  1. Open Notepad and type or paste your JSON.
  2. Choose File, then Save as.
  3. Set “Save as type” to All files (*.*). If you skip this, Windows saves data.json.txt.
  4. Type a name ending in .json, such as data.json.
  5. Set Encoding to UTF-8 if the option is shown, then click Save.

Prefer File Explorer? Turn on file name extensions first (in Windows 11 it is under View, then Show), right-click in a folder, choose New, then Text Document, and rename it to data.json. Accept the warning about changing the extension. You now have a blank JSON file to open and edit.

How do you create a JSON file on a Mac?

TextEdit works, but it saves rich text and swaps straight quotes for curly ones by default. Curly quotes are invalid in JSON, so change two settings first.

  1. Open TextEdit and create a new document.
  2. Choose Format, then Make Plain Text.
  3. Turn off smart quotes: Edit, then Substitutions, then untick Smart Quotes. You can also disable it for all new documents in TextEdit’s settings.
  4. Type your JSON, choose File, then Save, and name it data.json.
  5. If macOS asks whether to keep .json or use .txt, choose to use .json.

On a Mac or Linux terminal you can also create the file in one line: echo '{"name": "Ana"}' > data.json, or make an empty one with touch data.json.

How to make a JSON file in VS Code

For anything longer than a few lines, a code editor saves real time. In VS Code, choose File, then New File, and name it with a .json extension. VS Code switches to JSON mode, highlights syntax errors as you type and lists them in the Problems panel.

  • Format it: Shift+Alt+F on Windows, Shift+Option+F on Mac.
  • Schemas: VS Code can check known files such as package.json against a schema. See the VS Code JSON documentation.
  • Comments: VS Code accepts comments in some config files using “JSON with Comments” mode, but standard JSON does not allow them.

How to create a JSON file in Python

When the data already lives in your code, let Python write the file so the syntax is always correct:

import json

data = {"name": "Ana Silva", "age": 31, "tags": ["lead", "webinar"]}

with open("data.json", "w", encoding="utf-8") as f:
    json.dump(data, f, indent=2, ensure_ascii=False)

indent=2 makes it readable and ensure_ascii=False keeps accented names as real characters. The Python json module docs list every option. If your source is a text file rather than a Python object, our guide on converting TXT to JSON with Python, Node and jq walks through the parsing step.

Can you create a JSON file from Excel?

Excel has no built-in “Save as JSON” option. The simple route is:

  1. In Excel, choose File, then Save As, and pick CSV UTF-8.
  2. Drop the .csv into the CSV and TXT to JSON tool. The header row becomes the keys.
  3. Download the result: an array with one object per row.

Big export? Split it first with the CSV splitter so each JSON file stays a manageable size. If your data starts as a messy text export rather than a clean sheet, the TXT to CSV converter tidies it into columns first.

Which method should you use?

Method Cost Upload needed Best for
LeadCanal TXT to JSON tool Free No, runs in your browser Turning lists, pairs, CSV or TSV into JSON fast, on any device
Notepad (Windows) Free, built in No Small files typed by hand
TextEdit or terminal (Mac) Free, built in No Quick files and blank templates
VS Code Free No Config files and anything you edit often
Python Free No Generating JSON from code or automating it
Excel plus converter Excel licence No with our tool Spreadsheet data that needs to become JSON

Can you create a JSON file on iPhone or Android?

Neither phone has a JSON editor built in, and most notes apps add smart quotes. The easiest option is to open the JSON converter in Safari or Chrome, paste your text and tap download. The conversion runs on the phone itself, and the file lands in your Files app or Downloads folder.

Why our converter keeps your file on your device

JSON files often hold contact lists, API settings or customer records. Our converter runs entirely in your browser, so the file is never uploaded to LeadCanal or anyone else, and nothing is stored on a server. It also only opens the text formats it is built for and checks each file’s signature, so a renamed program is refused. That matters when the text contains personal data you are responsible for protecting.

Common JSON file errors and how to fix them

  • Unexpected token or invalid character: usually curly quotes or single quotes. Replace them with straight double quotes.
  • Trailing comma: {"a": 1,} is invalid. Remove the comma after the last item in every object and array.
  • File opens as text or the app rejects it: the real name is probably data.json.txt. Show file extensions and rename it.
  • Comments break the parser: delete // and /* */ lines, or move notes into a "_comment" key.
  • Garbled accents: save as UTF-8. On Windows, choose UTF-8 rather than ANSI.
  • Numbers lost their leading zeros: store ZIP codes, phone numbers and long IDs as strings.
  • Several objects with no brackets around them: wrap them in [ ] and separate them with commas, or paste them into the converter, which merges JSON lines into one array.

To check a finished file, paste it into the converter with “JSON (format it)” selected. If it is invalid you get the parser’s error message; if it is valid you get a cleanly indented copy.

Frequently asked questions

How to create JSON file in Windows 11?

Open Notepad, type your JSON, choose Save as, set the type to All files and name it data.json. Or paste your data into a free browser converter and download the .json file directly.

Can I create a JSON file from a text file?

Yes. A text to JSON converter reads lines, key: value pairs or CSV style rows and builds valid JSON. Renaming .txt to .json only works if the text is already valid JSON.

How do I create a blank JSON file?

Create an empty text file and rename it to something.json, or run touch data.json on Mac or Linux. Many apps expect at least {} or [] inside, so add one of those.

Can you put comments in a JSON file?

Not in standard JSON. Some tools accept “JSON with Comments” for config files, but parsers following the standard will fail. Use a “_comment” key if you need a note.

What is the difference between JSON and CSV?

CSV is a flat table of rows and columns. JSON can nest objects and lists and keeps types such as numbers and booleans, which is why APIs and config files prefer it.

Is it safe to create JSON files online?

It depends on the tool. Many online converters upload your file to their server. Ours runs in the browser, so the text never leaves your device.

What app opens a JSON file?

Any text editor opens it, including Notepad, TextEdit and VS Code. Chrome and Firefox also display JSON files, and Firefox shows them in a readable viewer.

Conclusion: key takeaways

Knowing how to create json file content comes down to valid syntax plus the right extension. Start from the tool if you already have the data, and use an editor when you are writing from scratch.

  • Paste existing text into a free TXT to JSON converter for valid JSON in seconds.
  • Save in Notepad as All files with a .json name so Windows does not add .txt.
  • On a Mac, use plain text mode and switch smart quotes off in TextEdit.
  • Use double quotes only and never leave a trailing comma or comment.
  • Keep ZIP codes, phone numbers and long IDs as strings so zeros survive.
  • Save as UTF-8 and validate the file before you hand it to an app.

Ready to make one now? Open the free TXT to JSON converter, or browse all of our free file and data tools. Need a spreadsheet instead? See our guide on turning text files into CSV, or pull addresses out of raw text with the email extractor.

Key takeaways

How to create a JSON file

1 Paste existing text into a free TXT to JSON converter for valid JSON in seconds.
2 Save in Notepad as All files with a .json name so Windows does not add .txt.
3 On a Mac, use plain text mode and switch smart quotes off in TextEdit.
4 Use double quotes only and never leave a trailing comma or comment.
5 Keep ZIP codes, phone numbers and long IDs as strings so zeros survive.
6 Save as UTF-8 and validate the file before you hand it to an app.

Editorial policy

This guide was written by people who work with data files daily. We test every method we describe, only state facts we can check against official documentation, and update the page when software menus or the JSON tooling we rely on change. We do not accept payment for placements or recommendations.

Content transparency

We researched this topic with keyword data on what people actually search, then checked the steps against the JSON standard (RFC 8259), the Python documentation and the VS Code documentation. LeadCanal built and offers the free TXT to JSON converter and other tools mentioned in this guide.

About the author

The LeadCanal team builds verified B2B lead lists, enriches CRM data and runs cold email infrastructure every day. That work means constant file wrangling: CSV lead lists, VCF contacts, JSON configs and PDF reports. We built our free browser-based converters to handle those jobs quickly without uploading anyone’s data.

Found this useful? Share it with your team.

Written by LeadCanal

The LeadCanal team builds verified B2B lists and runs cold email infrastructure for agencies and sales teams. Every guide comes from campaigns we send every day.

Done-for-you lead generation

Want this done for you?

Targeted lists and cold email campaigns that book qualified meetings.