JSON Object
时间: 2023-10-28 18:26:48 浏览: 141
A JSON object is a data type used in JavaScript and other programming languages to store and exchange data in a structured format. It is represented by a set of key-value pairs enclosed in curly braces {}. Each key-value pair is separated by a comma, and the key and value are separated by a colon. The key is a string that serves as an identifier for the value, and the value can be any valid JSON data type, including strings, numbers, objects, arrays, and boolean values. Here's an example of a JSON object:
{
"name": "John",
"age": 30,
"address": {
"street": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip": "12345"
},
"phoneNumbers": [
{
"type": "home",
"number": "555-555-1212"
},
{
"type": "work",
"number": "555-555-2121"
}
]
}
In this example, the object has four key-value pairs: "name" with a value of "John", "age" with a value of 30, "address" with a value of another nested object containing address details, and "phoneNumbers" with a value of an array containing two nested objects representing phone numbers.
阅读全文