十三、RF中对json的解析
A、需要安装的库
1.RequestsLibrary,安装命令:pip2 install requests 2.HttpLibrary,安装命令:pip2 install robotframework-httplibrary 3.HttpLibrary.HTTP,这个库是在HttpLibrary中,HTTP是HttpLibrary的一个class 4.json,安装命令:pip2 install jsonpatch 5.Collections,这个库是python自带的,直接引入即可 |
B、RF需导入的库
1. HttpLibrary 5.Collections--------------------------------------------------get from dictionary |
C、取json中的值
${json_data} set variable {"id": "18701236666","code": 200,"msg": "ok","data": {"tag_list": [{"game_id": "28","game_name": "天天酷跑"},{"game_id": "29","game_name": "斗地主"}]}} ${text01} Get Json Value ${json_data} /id
|
D、将json格式中[]转化成python中dict格式
#将json[]中的值转化成python dict格式
|
E、取值
#取值
|