2023/2/22 17:11:41來源:CSDN165 閱讀
dim json,json1,json2,json3,jsonStr,json4 set json=new Aien_Json '定義主json對象 json.JsonType="object" 'json數據結構為對象 json.addData "name","panzhiming" '添加數據 json.addData "isboy",true json.addData "age",23 json.addData "luckyNumber",Array(34,31,42) set json2=new Aien_Json '定義一個json子對象 json2.JsonType="object" '數據結構為對象 json2.addData "wife","xiaoming" '添加數據 json2.addData "school","miliangxiaoxue" set json3=new Aien_Json '定義一個json子對象 json3.JsonType="object" '數據結構為對象 json3.addData "chinese",85 '添加數據 json3.addData "english",90 set json4=new Aien_Json '定義一個json子對象 json4.JsonType="object" '數據結構為對象 json4.addData "chinese",85 '添加數據 json4.addData "english",90 set json5=new Aien_Json '定義一個json子對象 json5.JsonType="object" '數據結構為對象 json5.addData "chinese",85 '添加數據 json5.addData "english",90 set json1=new Aien_Json '定義一個json子對象 json1.JsonType="array" '數據結構為數組 json1.addData "color1","green" '添加數據 json1.addData "color2","red" json2.addData "classes",Array(json3,json4) '把json3添加到json2中,鍵名為classes json.addData "colors",json1 '把json1添加到json中,鍵名為colors json.addData "others",json2 '把json2添加到json中,鍵名為others json.addData "data",json5 jsonStr=json.getJson(json) '獲取最后生成的json字符串,本函數只有第一次調用有效 set json4=nothing set json3=nothing set json2=nothing set json1=nothing set json=nothing Response.write jsonStr
'//輸出生成數據
{
"name": "panzhiming",
"isboy": "true",
"age": "23",
"luckyNumber": [
"34",
"31",
"42"
],
"colors": [
"green",
"red"
],
"others": {
"wife": "xiaoming",
"school": "miliangxiaoxue",
"classes": [
{
"chinese": "85",
"english": "90"
},
{
"chinese": "85",
"english": "90"
}
]
},
"data": {
"chinese": "85",
"english": "90"
}
}
下一條:asp各種文件操作UTF-8
上一條:本地瀏覽器歷史記錄清除方法