一本色道久久88亚洲精精品综合 _中文字幕无线码一区2015_国产成人精品a视频_亚洲精品久久久久久久蜜桃臀_男人在线天堂8_嫩草久久久研究所_久久www香蕉免费人成_久久久久国产欧美久久久aaa

艾恩Asp生成Json數(shù)據(jù)類

2023/2/22 17:11:41來源:CSDN83 閱讀

    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"
        }
    }

    來源參考:https://blog.csdn.net/boys1999/article/details/43575811

    下一條:asp各種文件操作UTF-8

    上一條:本地瀏覽器歷史記錄清除方法

棗莊西橋網(wǎng)絡(luò)微信小程序微信小程序

棗莊西橋網(wǎng)絡(luò)手機站二維碼掃描手機瀏覽