【发布时间】:2013-03-01 08:04:53
【问题描述】:
我在 Robot Frame Work 中有一个具有以下格式的 Json 响应正文的变量
{
"jsonrpc": "2.0",
"id": "787878",
"result":
{
"content":
[
{
"id": 30,
"userID": "user",
"eventType":
{
"name": "test"
},
"timestamp": "2013-03-13T11:00:28.537Z",
"source": "Service",
"reason": null,
"comment": null,
"dataCache":
{
"lastLogin":
{
"id": 103,
"fieldName": "value1",
"newValue": "Wed Mar 13 07:00:28 EDT 2013",
"oldValue": null,
"type": "java.util.Date",
"auditEvent": null
}
},
"authority": "authenticate",
"auditedObject": null
}
],
"pageNumber": 0,
"pageSize": 99,
"numberOfElements": 1,
"totalElements": 1,
"lastPage": true,
"totalPages": 1
}
}
SO from this How can I get the content only datacache 如下所示
{
"lastLogin":
{
"id": 103,
"fieldName": "value1",
"newValue": "Wed Mar 13 07:00:28 EDT 2013",
"oldValue": null,
"type": "java.util.Date",
"auditEvent": null
}
},
如果我使用像 ${variable['result']['content']} 这样的变量,我将在内容中获得整个正文但我只想要“DataCache”中的正文:
请帮我解决这个问题..
【问题讨论】:
-
你不能再深入一点 ${variable['result']['content']['dataCache']}
-
我试过这个 "${variable['result']['content']['dataCache']}" 但没用
标签: python python-2.7 selenium-webdriver robotframework