What is JSON?
JSON stands for JavaScript Object Notation. It's a format used to store and exchange data, especially between a server and a web application.
How Does JSON Look?
JSON data is formatted as key-value pairs, similar to how you might organize information in a table or a dictionary. Here’s the basic structure:
{
"key1": "value1",
"key2": "value2"
}
Each key is a string (text), and each value can be a string, number, array, or even another JSON object!
Here’s a Simple Example:
{
"name": "John",
"age": 14,
"hobbies": ["reading", "gaming", "soccer"],
"address": {
"city": "New York",
"country": "USA"
}
}
In this example:
- name is a key with a string value of "John".
- age is a key with a number value of 14.
- hobbies is a key with an array of values (multiple hobbies).
- address is a key with another JSON object as its value, which contains city and country.
Why is JSON Useful?
JSON is lightweight and easy to read, which makes it great for exchanging data between applications. It’s used in many web APIs, making it essential for web developers.
Conclusion
Now you know what JSON looks like! Understanding this format can help you in programming and working with web technologies.