CH6: What Is JSON (JavaScript Object Notation) Flashcards

(7 cards)

1
Q

What is JSON and what is it used for?

A

JSON stands for JavaScript Object Notation. It’s a simple and human-readable way to store and share data between systems, especially websites and apps.

Example:
A website might save a user profile like this: { “name”: “Alice”, “age”: 25, “isStudent”: true }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does JSON data look like?

A

JSON data is made of keys and values. Keys are always in double quotes, and values can be text, numbers, true/false, or other objects and lists.

Example:
{ “name”: “Alice”, “age”: 25 } means the user’s name is Alice and her age is 25.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the two main structures used in JSON?

A

JSON uses:
- Objects: key-value pairs inside curly braces {}
- Arrays: ordered lists inside square brackets []

Example:
Object: { “city”: “Paris” } — Array: [“Paris”, “London”, “Rome”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What kinds of values can JSON store?

A

JSON can store:
- Strings: “hello”
- Numbers: 123
- Booleans: true or false
- Null values: null
- Arrays: [1, 2, 3]
- Objects: { “key”: “value” }

Example:
{ “isOnline”: true, “score”: 100 }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are some syntax rules for writing JSON correctly?

A

Some important rules:
- All keys must be in double quotes
- Objects use {}, arrays use []
- Items are separated with commas
- Files usually end in .json

Example:
This is valid: { “age”: 30, “name”: “Bob” } — don’t forget the commas and quotes!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why is JSON important and widely used?

A

JSON is popular because it’s:
- Easy to read and write
- Easy for computers to use
- Small in size, so it’s fast online
- Works with many languages like JavaScript, Python, and more

Example:
Unlike XML, JSON doesn’t need extra tags and is cleaner to read.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How is JSON used in real-world situations like APIs?

A

When websites or apps talk to each other, they often use JSON to send and get data. This is called an API.

Example:
A weather app might send: { “city”: “New York” }, and get back: { “temperature”: 72, “status”: “sunny” }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly