Skip to main content
InterviewHubPRO
Section Overview
Q120

Question 120 of 536

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

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

Why do you need JSON

mid LevelCode ExampleHTTP & REST APIs

When exchanging data between a browser and a server, the data can only be text. Since JSON is text only, it can easily be sent to and from a server, and used as a data format by any programming language.

Practical Code Example

javascript
// Why JSON: Language-independent, human-readable, natively parsed across all web platforms:
fetch('/api/user')
  .then(res => res.json()) // Native rapid serialization
  .then(data => console.log('Interchange format:', data));