示例說明
JSON 格式表示陣列
儲存名字的陣列: ["張三","李四","王五"]
儲存僱員的資訊: ["smith",1001,"clerck",7788,2000.00,200.0]
[
["smith",1001,"clerck",7788,2000.00,200.0]
]
{"name":"smith","empno":1001,"job":"clerck","sal":9000.00,"comm":5000.00},
Demo: 物件陣列
在一個數組儲存多個 json 物件 (在一個數組中儲存多個物件)
{
"title":"Java 開發",
"edition":3,
"author":["smith","張三","李四"]
},
"title":"Web 開發",
"author":["Allen","王五","趙六"]
}
二維陣列儲存
["Java 開發",3,["smith","張三","李四"]],
["Web 開發",3["Allen","王五","趙六"]]
示例說明
JSON 格式表示陣列
儲存名字的陣列: ["張三","李四","王五"]
儲存僱員的資訊: ["smith",1001,"clerck",7788,2000.00,200.0]
[
["smith",1001,"clerck",7788,2000.00,200.0]
["smith",1001,"clerck",7788,2000.00,200.0]
["smith",1001,"clerck",7788,2000.00,200.0]
]
[
{"name":"smith","empno":1001,"job":"clerck","sal":9000.00,"comm":5000.00},
{"name":"smith","empno":1001,"job":"clerck","sal":9000.00,"comm":5000.00},
{"name":"smith","empno":1001,"job":"clerck","sal":9000.00,"comm":5000.00},
]
Demo: 物件陣列
在一個數組儲存多個 json 物件 (在一個數組中儲存多個物件)
[
{
"title":"Java 開發",
"edition":3,
"author":["smith","張三","李四"]
},
{
"title":"Web 開發",
"edition":3,
"author":["Allen","王五","趙六"]
}
]
二維陣列儲存
[
["Java 開發",3,["smith","張三","李四"]],
["Web 開發",3["Allen","王五","趙六"]]
]