2023/2/22 17:11:41來源:CSDN107 閱讀
dim json,json1,json2,json3,jsonStr,json4 set json=new Aien_Json '定義主json對象 json.JsonType="object" 'json數(shù)據(jù)結(jié)構(gòu)為對象 json.addData "name","panzhiming" '添加數(shù)據(jù) json.addData "isboy",true json.addData "age",23 json.addData "luckyNumber",Array(34,31,42) set json2=new Aien_Json '定義一個json子對象 json2.JsonType="object" '數(shù)據(jù)結(jié)構(gòu)為對象 json2.addData "wife","xiaoming" '添加數(shù)據(jù) json2.addData "school","miliangxiaoxue" set json3=new Aien_Json '定義一個json子對象 json3.JsonType="object" '數(shù)據(jù)結(jié)構(gòu)為對象 json3.addData "chinese",85 '添加數(shù)據(jù) json3.addData "english",90 set json4=new Aien_Json '定義一個json子對象 json4.JsonType="object" '數(shù)據(jù)結(jié)構(gòu)為對象 json4.addData "chinese",85 '添加數(shù)據(jù) json4.addData "english",90 set json5=new Aien_Json '定義一個json子對象 json5.JsonType="object" '數(shù)據(jù)結(jié)構(gòu)為對象 json5.addData "chinese",85 '添加數(shù)據(jù) json5.addData "english",90 set json1=new Aien_Json '定義一個json子對象 json1.JsonType="array" '數(shù)據(jù)結(jié)構(gòu)為數(shù)組 json1.addData "color1","green" '添加數(shù)據(jù) json1.addData "color2","red" json2.addData "classes",Array(json3,json4) '把json3添加到j(luò)son2中,鍵名為classes json.addData "colors",json1 '把json1添加到j(luò)son中,鍵名為colors json.addData "others",json2 '把json2添加到j(luò)son中,鍵名為others json.addData "data",json5 jsonStr=json.getJson(json) '獲取最后生成的json字符串,本函數(shù)只有第一次調(diào)用有效 set json4=nothing set json3=nothing set json2=nothing set json1=nothing set json=nothing Response.write jsonStr
'//輸出生成數(shù)據(jù)
{
"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
上一條:本地瀏覽器歷史記錄清除方法
微信小程序
掃描手機瀏覽