如何使用robotframework关键字从JSON字符串中获取必需的参数 [英] How to get a required parameter from JSON String using robotframework keyword

查看:1835
本文介绍了如何使用robotframework关键字从JSON字符串中获取必需的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的JSON响应字符串

The following is my JSON response string

{
 "macKey": "This_is_a_Test_QED_MAC_Key_Which_Needs_to_be_at_Least_32_Bytes_Long",
"subject": "delivery@token.com",
"audience": "qed:test",
"expirationTime": "2016-03-09T23:07:52Z",
"notBeforeTime": "2016-03-09T23:07:52Z",
"jwtId": "",
"permissions": [
"MANAGE_SYSTEM"
],
"useCompactPermissions": false,
"url": "http://172.30.2.155:8080/",
"generatedToken": "eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZXN0Iiwic3ViIjoiZGVsaXZlcnlAdG9rZW4uY29tIiwiYXVkIjoicWVkOnRlc3QiLCJxZWRwIjpbIm1hbmFnZVN5c3RlbSJdLCJleHAiOjE0NTc1NjQ4NzJ9.8KlDoK-t6HoOth3na2x6drEAFfXCGLKLt3aAMGg0r0U",
"qeda": null,
"qedp": [
"manageSystem"
],
"issueTime": "2016-03-09T09:34:40Z"
}

在上面的代码中,我需要采用 generatedToken 值.

From the above one I need to take generatedToken value.

推荐答案

您可以使用 robotframework-httplibrary 那么您可以像这样获得它:

You can use robotframework-httplibrary then you can get it like this:

${value}= Get Json Value ${json} /generatedToken

这篇关于如何使用robotframework关键字从JSON字符串中获取必需的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆