InterviewHubPRO
Section Overview
Q116

Question 116 of 521

Part 3: DOM, Event Flow, Timers & Browser APIs (104 - 173)

22%
JavaScript Internals (521 Qs)•Part 3: DOM, Event Flow, Timers & Browser APIs (104 - 173)

What is JSON

JSON (JavaScript Object Notation) is a lightweight format that is used for data interchanging. It is based on a subset of JavaScript language in the way objects are built in JavaScript.

Practical Code Example

javascript
// JSON (JavaScript Object Notation): Lightweight text data-interchange format
const jsonString = '{"name":"Devin","skills":["TS","React"]}';

// Parsing to JS Object:
const parsed = JSON.parse(jsonString);
console.log(parsed.name); // 'Devin'

// Serializing to JSON string:
const serialized = JSON.stringify(parsed);
console.log(typeof serialized); // 'string'