InterviewHubPRO
Section Overview
Q120

Question 120 of 521

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

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

Why do you need JSON

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));