What is JSON? A practical guide to the format and its files

JSON is a plain-text way to represent data. If you can read a list of names and values, you can read the basics of JSON. This guide walks through a real example, the punctuation, and the everyday questions about .json files.

What is JSON, and what does JSON stand for?

JSON stands for JavaScript Object Notation. It is a text format for exchanging structured data between programs. Its name comes from JavaScript, but JSON is language-independent: applications written in many languages can read and write it.

JSON stores values inside objects and arrays. An object gives values names, such as "name" or "active". An array holds values in order, such as a list of skills. A complete JSON document can also be a single string, number, boolean, or null, though objects and arrays are the most common files you will encounter.

A small JSON document

{
  "name": "Asha",
  "active": true,
  "skills": ["HTML", "CSS"],
  "projects": 3,
  "manager": null
}

Here, "name" is a key and "Asha" is its string value. true is a boolean, 3 is a number, null means there is no value, and the values inside [ ] form an array.

What is a JSON file?

A JSON file, often called a .json file, is a text file containing JSON data. The .json extension identifies its format; it does not require a special program to read the text. A file named person.json might contain the example above.

JSON files are common in app settings, data exports, and information passed between a website and an API. The file is intended for programs to parse, but its text is usually readable by people too. Pretty printing adds line breaks and indentation for people; it does not change the data.

What is JSON format?

JSON format is a small set of rules for writing values. The marks carry meaning:

MarkMeaningExample
{ }An object with named members{"age": 3}
[ ]An ordered array of values["HTML", "CSS"]
:Separates an object key from its value"age": 3
,Separates members or array items[1, 2]
" "Surrounds keys and string values"name"

Values can be strings, numbers, true, false, null, objects, or arrays. Object keys must be strings in double quotes. Strings also use double quotes. JSON permits spaces, tabs, and line breaks around structural marks, so both one-line and indented forms can be valid.

The square brackets in "skills": ["HTML", "CSS"] mean the skills value is a list. See the square brackets guide for empty, nested, and mixed arrays, plus common bracket errors.

What is JSON used for?

Programs use JSON when they need to share data in a predictable shape. A website might receive a product list from an API, an app might save preferences in a settings.json file, or a service might export records for another tool. The same object-and-array structure can represent a single record or thousands of records.

JSON describes data rather than its visual presentation. If you want to show that data on a web page, you can convert JSON to an HTML table or list.

For spreadsheet imports, you can convert JSON to CSV, with separate steps for the browser tool, Excel, and Python.

How to open a JSON file

  1. Find the file ending in .json.
  2. Open it with a text editor, such as Notepad on Windows, TextEdit in plain-text mode on macOS, or a code editor. You can usually right-click the file and choose Open with.
  3. Read or edit the text. If it is all on one line, use a code editor’s Format Document command to indent it.

You can also open many .json files in a web browser to read them. To work with the data as a table, choose the file in the JSON to HTML converter. Treat JSON files from unknown sources as text; there is no reason to run a program just to inspect one.

How to create a JSON file

  1. Open a plain-text editor and type a valid JSON value. Start with { } for named fields or [ ] for a list.
  2. Put object keys and text values in double quotes. Add commas between items, never after the last item.
  3. Save as UTF-8 text with a .json extension, such as person.json. In Notepad, choose All files if needed so the name does not become person.json.txt.
  4. Check that a JSON parser or editor accepts it. Our converter will report common syntax errors with a line and column.

A common mistake, followed by valid JSON

{
  name: 'Asha',
  "skills": ["HTML", "CSS",],
  // the last skill is new
}
{
  "name": "Asha",
  "skills": ["HTML", "CSS"]
}

The first version has an unquoted key, single-quoted text, a trailing comma, and a comment. The second version fixes all four.

How to comment in JSON

Standard JSON has no comment syntax. Neither // nor /* ... */ is allowed in a JSON document. If a file accepts those marks, the program may be using a JSON-like extension rather than standard JSON.

If you control the data format and need a note, you can add a normal field such as "note": "Shown to editors only". That field is real data, so only do this when the receiving program allows it. Otherwise keep the explanation in a separate README or documentation file.

What is the difference between XML and JSON?

Both formats can exchange structured information. JSON uses objects, arrays, and typed values. XML uses nested elements marked with opening and closing tags, and it can also attach attributes to elements. The same simple record could look like this:

JSON

{
  "name": "Asha",
  "active": true,
  "skills": ["HTML", "CSS"]
}

XML

<person>
  <name>Asha</name>
  <active>true</active>
  <skills><skill>HTML</skill><skill>CSS</skill></skills>
</person>
QuestionJSONXML
How is a list shown?An array inside [ ]Repeated elements, such as multiple <skill> tags
How are values typed?Strings, numbers, booleans, and null have JSON syntaxElement text is text unless an application or schema assigns a type
How is structure marked?Braces, brackets, keys, and commasTags, attributes, and nesting

Choose the format the receiving system expects. JSON is common for web APIs and app configuration; XML remains useful where a document or integration already relies on XML elements, attributes, or schema rules.

Quick answers

What are JSON files?

They are plain-text files containing data written in JSON format, typically named with the .json extension.

Is a .json file the same as JSON?

JSON is the format. A .json file is one way to store text in that format. JSON can also travel directly in an API response without a file.

Can I open .json files without coding?

Yes. Open the file in a text editor to read it, or use a viewer or converter to display its structure.