如何将嵌套的JSON数据导入Postman';谁是收藏家?
我有以下“嵌套JSON”数据:如何将嵌套的JSON数据导入Postman';谁是收藏家?,json,rest,postman,postman-collection-runner,Json,Rest,Postman,Postman Collection Runner,我有以下“嵌套JSON”数据: [{ "method":"POST", "endpoint":"/users", "body":{ "username":"ZStGQoTVGvtBO", "role":"DEVICE_ADMINISTRATOR" }, "res_code":400, "auth":[ "4565786", "bncfgnjfgnjgt" ] }] 如何将其导入Postman
[{
"method":"POST",
"endpoint":"/users",
"body":{
"username":"ZStGQoTVGvtBO",
"role":"DEVICE_ADMINISTRATOR"
},
"res_code":400,
"auth":[
"4565786",
"bncfgnjfgnjgt"
]
}]
如何将其导入Postman collection runner?我能够导入简单的JSON数据,但不能导入嵌套的JSON。
此外,导入“auth”元素时似乎存在问题,有时忽略“auth”元素,有时仅导入“auth”的第二个值。您可以在请求前脚本中手动执行此操作:
pm.variables.set("username", data.body.username);//<- acess to nested value, you can't use {{body.username}}
pm.variables.set("bodyPart", JSON.stringify(data.someobject))