测试JsonAnalyzer2的12个测试用例:
测试用例如下:
01.
Compact json text={"status":"0000","message":"success","data":{"title":{"id":"001","name":"白菜"},"content":[{"id":"001","value":"你好白菜"},{"id":"002","value":"你好萝卜"}]}} { "data":{ "content":[ { "id":"001", "value":"你好白菜" }, { "id":"002", "value":"你好萝卜" } ], "title":{ "id":"001", "name":"白菜" } }, "message":"success", "status":"0000" }
02.
Compact json text={"animal":"cat","color":"orange"} { "animal":"cat", "color":"orange" }
03.
Compact json text={"name":"Flutty","breed":"Siamese","age":2} { "age":2, "breed":"Siamese", "name":"Flutty" }
04.
Compact json text={"person":{"name":"LindsayBassett","heightInInches":66,"head":{"hair":{"color":"lightblood","length":"short","style":"a-line"},"eyes":"green"}}} { "person":{ "head":{ "eyes":"green", "hair":{ "color":"lightblood", "length":"short", "style":"a-line" } }, "heightInInches":66, "name":"LindsayBassett" } }
05.
Raw json text={"eggCartoon":["egg","egg","egg","egg","egg","egg","egg",null,"egg",null,"egg",]} Compact json text={"eggCartoon":["egg","egg","egg","egg","egg","egg","egg",null,"egg",null,"egg",]} { "eggCartoon":[ "egg", "egg", "egg", "egg", "egg", "egg", "egg", null, "egg", null, "egg" ] }
06.
Raw json text={"students":["张三","李四","王五","赵六","孙琪","钱吧"]} Compact json text={"students":["张三","李四","王五","赵六","孙琪","钱吧"]} { "students":[ "张三", "李四", "王五", "赵六", "孙琪", "钱吧" ] }
07.
Raw json text={"scores":[128,113,105,120,100]} Compact json text={"scores":[128,113,105,120,100]} { "scores":[ 128, 113, 105, 120, 100 ] }
08.
Raw json text={"employees": [{ "firstName":"Bill" , "lastName":"Gates" },{ "firstName":"George" , "lastName":"Bush" },{ "firstName":"Thomas" , "lastName":"Carter" }]} Compact json text={"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]} { "employees":[ { "firstName":"Bill", "lastName":"Gates" }, { "firstName":"George", "lastName":"Bush" }, { "firstName":"Thomas", "lastName":"Carter" } ] }
09.
Raw json text={ "name": "username", "age": 20, "admin": true } Compact json text={"name":"username","age":20,"admin":true} { "admin":true, "age":20, "name":"username" }
10.
Raw json text={ "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-26 23_09", "utc": "2017-10-26 15_09" } }]} Compact json text={"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"}}]} { "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.
Raw json text={ "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": "配送準備中" } ] } ]} Compact json text={"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":"配送準備中"}]}]} { "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" } ] }
12.
Raw json text={ "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"]} Compact json text={"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月25日--