JSON & the DOM

Lesson 1 of 6

What is JSON?

JSON (JavaScript Object Notation) is a lightweight, text-based format for representing structured data. It's how APIs send data over a network, how config files get written, and how you persist data to disk or localStorage.

Valid JSON values

JSON supports exactly six types: string, number, boolean, null, object, and array. Notably absent: undefined, functions, and comments, none of those exist in JSON.

JavaScript

JSON vs a JavaScript object literal

They look almost identical, but JSON is a text format: keys and string values must use double quotes, and it can't contain functions, undefined, Date objects, or comments. A JavaScript object literal has none of those restrictions, it's just code.

JavaScript

📝 JSON Basics Quiz

Passing score: 70%
  1. 1.Which of these is NOT a valid JSON value type?

  2. 2.JSON object keys must be wrapped in double quotes.

  3. 3.JSON stands for JavaScript Object ____.