Back to Web

What is JSON and why do web APIs use it?

JSON (JavaScript Object Notation) is a text format for representing structured data with objects, arrays, strings, numbers, booleans, and null. It became the de facto format for many REST and fetch APIs because it maps cleanly to JavaScript data structures and is widely supported. You still need validation: clients should not trust arbitrary JSON, and you must handle errors and schema evolution in real systems.

const res = await fetch('/api/cart');
const data = await res.json();
JSON.stringify({ ok: true });

Start simple: try this concept in a tiny project before moving to advanced tools.

jsonapijavascript

Want to check this topic right now?

Check this question