CodingNic

Web Fundamentals

Working with JSON

Web Fundamentals 10 min read

Working with JSON

Working with JSON

When applications communicate over the web, they need a common format to exchange data.

JSON is the most widely used format for this purpose.

What is JSON?

JSON stands for JavaScript Object Notation.

It is a lightweight format used to store and transmit data between systems.

JSON is easy for humans to read and easy for machines to parse.

JSON Structure

JSON is built using key–value pairs.

Example:

id="json-example-basic"
{ "name": "Alice", "age": 25, "isActive": true }

Data Types in JSON

JSON supports a limited set of data types:

  • Strings
  • Numbers
  • Booleans
  • Arrays
  • Objects
  • Null

JSON Objects

An object is a collection of key–value pairs.

id="json-object"
{ "id": 1, "name": "John", "email": "john@example.com" }

JSON Arrays

An array is a list of values.

id="json-array"
[ "apple", "banana", "orange" ]

Nested JSON

JSON can contain nested structures.

id="json-nested"
{ "user": { "name": "Alice", "age": 25 }, "skills": ["Python", "Web Development"] }

How JSON is Used in Web Development

JSON is commonly used in APIs.

  • Clients send JSON in requests
  • Servers return JSON in responses

Example:

id="json-api"
{ "status": "success", "data": { "id": 1, "name": "Alice" } }

Why JSON Matters

JSON is the standard format for data exchange on the web.

  • Used in REST APIs
  • Supported by all modern languages
  • Easy to read and debug

Summary

  • JSON is a lightweight data format
  • It uses key–value pairs
  • It supports objects and arrays
  • It is widely used in APIs

You’ve now completed the foundation of how the web works.

In the next module, you’ll set up your development environment and start building real applications.