Skip to content

Lesson 08 · JavaScript

JavaScript Foundations: JSON & Data Exchange

Data as text: what JSON allows and forbids, stringify and parse with their options, round-tripping nested values, and parsing untrusted input safely.

Prerequisites: JavaScript Foundations: Objects in Practice

Learning objectives
By the end of this lesson, you will be able to:
  • Distinguish a JavaScript object from a JSON string
  • Serialize values with JSON.stringify, pretty printing or a replacer
  • Parse JSON strings with JSON.parse, including a reviver
  • Round-trip nested data and know what does not survive
  • Parse untrusted text defensively inside try/catch