zoukankan      html  css  js  c++  java
  • 测试JsonAnalyzer解析Json的十一个测试用例

    目测以下测试用例都是通过的.

    01.

    原文={"status":"0000","message":"success","data":{"title":{"id":"001","name":"白菜"},"content":[{"id":"001","value":"你好白菜"},{"id":"002","value":"你好萝卜"}]}}
    分析整形后json文本=
    {
        "data":{
            "content":[
                {
                    "id":"001",
                    "value":"你好白菜"
                },
                {
                    "id":"002",
                    "value":"你好萝卜"
                }
            ],
            "title":{
                "id":"001",
                "name":"白菜"
            }
        },
        "message":"success",
        "status":"0000"
    }

    02.

    原文={"animal":"cat","color":"orange"}
    分析整形后json文本=
    {
        "animal":"cat",
        "color":"orange"
    }

    03.

    原文={"name":"Flutty","breed":"Siamese","age":2}
    分析整形后json文本=
    {
        "age":2,
        "breed":"Siamese",
        "name":"Flutty"
    }

    04.

    原文={"person":{"name":"LindsayBassett","heightInInches":66,"head":{"hair":{"color":"lightblood","length":"short","style":"a-line"},"eyes":"green"}}}
    分析整形后json文本=
    {
        "person":{
            "head":{
                "eyes":"green",
                "hair":{
                    "color":"lightblood",
                    "length":"short",
                    "style":"a-line"
                }
            },
            "heightInInches":66,
            "name":"LindsayBassett"
        }
    }

    05.

    原文={"eggCartoon":["egg","egg","egg","egg","egg","egg","egg",null,"egg",null,"egg",]}
    分析整形后json文本=
    {
        "eggCartoon":[
            "egg",
            "egg",
            "egg",
            "egg",
            "egg",
            "egg",
            "egg",
            null,
            "egg",
            null,
            "egg"
        ]
    }

    06.

    原文={"students":["张三","李四","王五","赵六","孙琪","钱吧"]}
    分析整形后json文本=
    {
        "students":[
            "张三",
            "李四",
            "王五",
            "赵六",
            "孙琪",
            "钱吧"
        ]
    }

    07.

    原文={"scores":[128,113,105,120,100]}
    分析整形后json文本=
    {
        "scores":[
            128,
            113,
            105,
            120,
            100
        ]
    }

    08.

    原文={"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}
    分析整形后json文本=
    {
        "employees":[
            {
                "firstName":"Bill",
                "lastName":"Gates"
            },
            {
                "firstName":"George",
                "lastName":"Bush"
            },
            {
                "firstName":"Thomas",
                "lastName":"Carter"
            }
        ]
    }

    09.

    原文={"name":"username","age":20,"admin":true}
    分析整形后json文本:=
    {
        "admin":true,
        "age":20,
        "name":"username"
    }

    10.

    原文={"HeWeather6":[{"basic":{"cid":"CN101010100","location":"北京","parent_city":"北京","admin_area":"北京","cnty":"中国","lat":"39.90498734","lon":"116.40528870","tz":"8.0"},"daily_forecast":[{"cond_code_d":"103","cond_code_n":"101","cond_txt_d":"晴间多云","cond_txt_n":"多云","date":"2017-10-26","hum":"57","pcpn":"0.0","pop":"0","pres":"1020","tmp_max":"16","tmp_min":"8","uv_index":"3","vis":"16","wind_deg":"0","wind_dir":"无持续风向","wind_sc":"微风","wind_spd":"5"},{"cond_code_d":"101","cond_code_n":"501","cond_txt_d":"多云","cond_txt_n":"","date":"2017-10-27","hum":"56","pcpn":"0.0","pop":"0","pres":"1018","tmp_max":"18","tmp_min":"9","uv_index":"3","vis":"20","wind_deg":"187","wind_dir":"南风","wind_sc":"微风","wind_spd":"6"},{"cond_code_d":"101","cond_code_n":"101","cond_txt_d":"多云","cond_txt_n":"多云","date":"2017-10-28","hum":"26","pcpn":"0.0","pop":"0","pres":"1029","tmp_max":"17","tmp_min":"5","uv_index":"2","vis":"20","wind_deg":"2","wind_dir":"北风","wind_sc":"3-4","wind_spd":"19"}],"status":"ok","update":{"loc":"2017-10-2623:09","utc":"2017-10-2615:09"}}]}
    分析整形后json文本=
    {
        "HeWeather6":[
            {
                "basic":{
                    "admin_area":"北京",
                    "cid":"CN101010100",
                    "cnty":"中国",
                    "lat":"39.90498734",
                    "location":"北京",
                    "lon":"116.40528870",
                    "parent_city":"北京",
                    "tz":"8.0"
                },
                "daily_forecast":[
                    {
                        "cond_code_d":"103",
                        "cond_code_n":"101",
                        "cond_txt_d":"晴间多云",
                        "cond_txt_n":"多云",
                        "date":"2017-10-26",
                        "hum":"57",
                        "pcpn":"0.0",
                        "pop":"0",
                        "pres":"1020",
                        "tmp_max":"16",
                        "tmp_min":"8",
                        "uv_index":"3",
                        "vis":"16",
                        "wind_deg":"0",
                        "wind_dir":"无持续风向",
                        "wind_sc":"微风",
                        "wind_spd":"5"
                    },
                    {
                        "cond_code_d":"101",
                        "cond_code_n":"501",
                        "cond_txt_d":"多云",
                        "cond_txt_n":"",
                        "date":"2017-10-27",
                        "hum":"56",
                        "pcpn":"0.0",
                        "pop":"0",
                        "pres":"1018",
                        "tmp_max":"18",
                        "tmp_min":"9",
                        "uv_index":"3",
                        "vis":"20",
                        "wind_deg":"187",
                        "wind_dir":"南风",
                        "wind_sc":"微风",
                        "wind_spd":"6"
                    },
                    {
                        "cond_code_d":"101",
                        "cond_code_n":"101",
                        "cond_txt_d":"多云",
                        "cond_txt_n":"多云",
                        "date":"2017-10-28",
                        "hum":"26",
                        "pcpn":"0.0",
                        "pop":"0",
                        "pres":"1029",
                        "tmp_max":"17",
                        "tmp_min":"5",
                        "uv_index":"2",
                        "vis":"20",
                        "wind_deg":"2",
                        "wind_dir":"北风",
                        "wind_sc":"3-4",
                        "wind_spd":"19"
                    }
                ],
                "status":"ok",
                "update":{
                    "loc":"2017-10-2623:09",
                    "utc":"2017-10-2615:09"
                }
            }
        ]
    }

    11.

    原文={"data":[{"deliveryListId":"20180001","shipperCode":"0030","shortShipperName":"RB","orderNo":"102018032001","deliveryOrder":1,"receiverName":"吉田XXX","receiverTelNo":"07012340303","receiverAddress1":"東京都足立区足立1-1","receiverAddress2":"東京都足立区足立1-2","isCod":true,"billAmount":5,"geocodingScore":50,"latitudeJP":"56789.33","longitudeJP":"123456.33","latitude":"20180001.22","longitude":"20180001.33","vehicleId":"239","orderDetails":[{"trackingNo":"201803200001","quantity":1,"lapCount":null,"statusCode":null,"statusNameMobile":null},{"trackingNo":"201803200002","quantity":1,"lapCount":4,"statusCode":"100","statusNameMobile":"配送準備中"},{"trackingNo":"201803200003","quantity":1,"lapCount":4,"statusCode":"300","statusNameMobile":"持出し"},{"trackingNo":"201803200004","quantity":1,"lapCount":4,"statusCode":"100","statusNameMobile":"配送準備中"},{"trackingNo":"201803200005","quantity":1,"lapCount":4,"statusCode":"100","statusNameMobile":"配送準備中"}]}]}
    分析整形后json文本=
    {
        "data":[
            {
                "billAmount":5,
                "deliveryListId":"20180001",
                "deliveryOrder":1,
                "geocodingScore":50,
                "isCod":true,
                "latitude":"20180001.22",
                "latitudeJP":"56789.33",
                "longitude":"20180001.33",
                "longitudeJP":"123456.33",
                "orderDetails":[
                    {
                        "lapCount":null,
                        "quantity":1,
                        "statusCode":null,
                        "statusNameMobile":null,
                        "trackingNo":"201803200001"
                    },
                    {
                        "lapCount":4,
                        "quantity":1,
                        "statusCode":"100",
                        "statusNameMobile":"配送準備中",
                        "trackingNo":"201803200002"
                    },
                    {
                        "lapCount":4,
                        "quantity":1,
                        "statusCode":"300",
                        "statusNameMobile":"持出し",
                        "trackingNo":"201803200003"
                    },
                    {
                        "lapCount":4,
                        "quantity":1,
                        "statusCode":"100",
                        "statusNameMobile":"配送準備中",
                        "trackingNo":"201803200004"
                    },
                    {
                        "lapCount":4,
                        "quantity":1,
                        "statusCode":"100",
                        "statusNameMobile":"配送準備中",
                        "trackingNo":"201803200005"
                    }
                ],
                "orderNo":"102018032001",
                "receiverAddress1":"東京都足立区足立1-1",
                "receiverAddress2":"東京都足立区足立1-2",
                "receiverName":"吉田XXX",
                "receiverTelNo":"07012340303",
                "shipperCode":"0030",
                "shortShipperName":"RB",
                "vehicleId":"239"
            }
        ]
    }

    --END 2020年5月18日--

    12.

    原文={"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"age":{"type":"integer"},"club":{"type":"object","properties":{"name":{"type":"string"},"founded":{"type":"integer"}},"required":["name"]}},"required":["first_name","last_name","age","club"]}
    

    整形后文本= { "properties":{ "age":{ "type":"integer" }, "club":{ "properties":{ "founded":{ "type":"integer" }, "name":{ "type":"string" } }, "required":[ "name" ], "type":"object" }, "first_name":{ "type":"string" }, "last_name":{ "type":"string" } }, "required":[ "first_name", "last_name", "age", "club" ], "type":"object" }

    --2020年5月22日--

  • 相关阅读:
    vim的三种模式
    vi/vim 三种模式的操作
    vim(vi)下的三种模式及其相关命令
    linux下查看最消耗CPU、内存的进程
    hdu 5288 OO’s Sequence
    宿主机mac os无法连接到虚拟机centos
    cloudstack给已有zone加入物理网络
    oracle刚開始学习的人经常使用操作100问
    七天学会ASP.NET MVC (四)——用户授权认证问题
    JEECG常见问题大全征集
  • 原文地址:https://www.cnblogs.com/heyang78/p/12911174.html
Copyright © 2011-2022 走看看