json代码

JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write, and easy for machines to parse and generate. It uses key-value pairs and supports various data types. Here's an example of JSON code:

json
{ "name": "John Doe", "age": 30, "city": "New York", "isStudent": false, "grades": [95, 87, 92], "address": { "street": "123 Main St", "zipCode": "10001" } }

In this example:

"name", "age", "city", "isStudent" are keys with string, number, string, and boolean values respectively."grades" is a key with an array value containing numbers."address" is a key with an object value containing nested key-value pairs.

JSON is often used for representing structured data in web applications, APIs, configuration files, and more.

Certainly! Let's expand on the previous example and include more complex structures:

json
{ "person": { "name": "John Doe", "age": 30, "city": "New York", "isStudent": false, "grades": [95, 87, 92], "address": { "street": "123 Main St", "zipCode": "10001", "coordinates": { "latitude": 40.7128, "longitude": -74.0060 } } }, "friends": [ { "name": "Alice", "age": 28, "city": "San Francisco" }, { "name": "Bob", "age": 32, "city": "Los Angeles" } ], "isActive": true }

In this extended example:

The "person" key has an associated object with nested structures, including an array ("grades") and another nested object ("address") with its own nested object ("coordinates").The "friends" key has an associated array with two objects representing friends, each with their own properties.The top-level key "isActive" is a boolean.

JSON is flexible and can represent a wide variety of data structures, making it a popular choice for data exchange between different programming languages and systems.