Premium lesson

The JavaScript Object Notation

JavaScript·3 min read·Jan 1, 2025

The JavaScript Object Notation (JSON) is a language-agnostic data format used to store collections of data in the form of key-value pairs, that is easy for humans to read and write, and easy for machines to parse and generate.

It is commonly used to create configuration files, exchange data between applications, or store data in databases.

Although relatively similar to object literals, JSON objects are only meant to store data and do not allow for computed property names or additional properties, such as methods.

The JSON syntax

Similar to object literals, JSON objects are declared using angle brackets:

variable = {};

JSON property keys must be enclosed in double quotes and properties themselves separated by comma characters:

{  "key": "value",  "key": value,  ...}

The JSON data types

JSON supports the following data types:

  • String: Enclosed in double quotes (e.g., "Hello").
  • Number: Integer or floating-point (e.g., 42, 3.14).
icon light bulb key

Unlock the Build CLI Apps in JavaScript & Node.js module

Learn how to build, integrate, and safeguard scalable CLI tools, scripts, and apps with JavaScript, Node.js, npm, and Git.

You get immediate access to:

  • 45 focused lessons across JavaScript, Node.js, npm, and Git
  • 17 real-world projects with commented solutions
  • Ongoing updates to this bundle
  • Lifetime access to this bundle
Unlock this module