const jsonData = { “name”: “John Doe”, “age”: 30, “email”: “johndoe@example.com”, “address”: { “street”: “123 Main Street”, “city”: “New York”, “state”: “NY”, “zip”: “10001” }, “interests”: [“coding”, “reading”, “traveling”], “friends”: [ { “name”: “Jane Smith”, “email”: “janesmith@example.com” }, { “name”: “Mike Johnson”, “email”: “mikejohnson@example.com” } ] }; ```
The code above is an example of a JavaScript object written in the JSON format. It represents the data of a person named John Doe. The object has various properties such as name, age, email, and address, as well as nested objects like address and friends.
Some important points to note about this JSON data:
- The object starts and ends with curly braces.
- Each property is written as a key-value pair, separated by a colon.
- String values are enclosed in double quotes.
- Numeric values, like the age property, are not quoted.
- Nested objects, like the address object, are represented within curly braces as well.
- Arrays, such as the interests and friends properties, are enclosed in square brackets.
JSON (JavaScript Object Notation) is a lightweight data interchange format widely used in web development. It is easy to read and write for both humans and machines, making it a popular choice for representing and exchanging data in various APIs and data storage systems.