Course contentsShow
← JavaScript
Lesson 677 of 2,72316. Object Methods and PatternsFree lesson

What is JSON?

Understanding JSON as a text-based data interchange format and its relationship to JavaScript objects.

What is JSON?

You'll learn: What JSON is and how it connects to JavaScript objects.

What Does JSON Stand For?

JSON stands for JavaScript Object Notation. It's a lightweight, text-based format for storing and exchanging data between systems. Think of it as a universal language that different programs—whether they're written in JavaScript, Python, Java, or any other language—can use to share information.

How JSON Relates to JavaScript

JSON looks almost identical to JavaScript object literals, but with stricter rules:

  • Property names must be in double quotes
  • Values can only be: strings, numbers, booleans, arrays, objects, or null
  • No functions, undefined, or dates (without conversion)
  • No trailing commas allowed

Here's the key difference:

JavaScript Object:

{ name: 'Alice', age: 30 }  // Valid JS

JSON (as text):

{"name":"Alice","age":30}

Why JSON Matters

JSON is the standard format for web APIs. When your JavaScript code fetches data from a server, it usually arrives as JSON text. You then convert it to a real JavaScript object to work with it.

Think of JSON as a "frozen" version of data—it's just text sitting in a file or traveling over the internet. Once it reaches JavaScript, you "thaw" it back into a living object you can manipulate.

The Text vs Object Distinction

JSON isn't an object—it's a string representation of data that looks like an object. You'll use built-in JavaScript methods to convert between JSON text and actual objects (we'll cover those methods in upcoming lessons).

Key Takeaway: JSON is a text-based format for data exchange that closely resembles JavaScript object syntax but follows stricter rules and exists as plain text until parsed.