ReadyAPI Property transfer - value from response, count of json object/array
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ReadyAPI Property transfer - value from response, count of json object/array
Hi folks,
I want to implement Property Transfer step in my readyapi project and trying to get value from GraphQL Request response and from the response I need to fetch count of particular json objects/arrays and save as property, for example:
{
"data" : {
"Info" : {
"edges" : [
{
"node" : {
"info" : [
{
"nodeName" : "abc",
"code" : "abc",
"Devices" : [
{
"Id" : "abc",
"dev" : "123",
"mod" : "abc"
},
{
"Id" : "abc",
"dev" : "123",
"mod" : "abc"
},
{
"Id" : "abc",
"dev" : "123",
"mod" : "abc"
}
]
}
]
}
}
]
}
}
}
From above response I need to save count of devices which is 3 here, however
$['data']['Info']['edges'][0]['node']['info'][0]['Devices'].length -> This json path returns 3 when I run it in jsonpath.com site, but it returns null when I use the same json path in readyApi
Any advice?
- Labels:
-
Function Tests
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could try....
log.info(data.Info.edges[0].node.info[0].Devices[0].Id);
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
OK, there is another very similar thread on this forum. I suggested adding one item at a time...
log.info(data)
log.info(data.Info)
log.info(data.Info.edges)
log.info(data.Info.edges[0])
This might show where we have gone wrong in navigating the object.
