Hi there,
I have the below response body and would like to save the “url” value from the property to a collection Variable.
{
"status": "success",
"pageStatus": 200,
"scrapeDate": "2022/11/21",
"scrapeHour": "21:24:29",
"results": {
"scopedto": ".class",
"links": [
{
"text": "",
"host": "abc.com",
"url": "https://abc.com/defg/",
"radiusContext": {
"parentText": "akajsdfhs",
"nextSiblingText": "akajsdfhs"
}
}
],
"partialPaths": [],
"imageUrls": [
{
"host": "example.com",
"url": "https://www.example.com/kasjdhksdhfkjsdhkjhsdfk"
}
]
}
}
I’ve already tried:
let response = pm.response.json();
pm.collectionVariables.set(“url”, response.results.links.url);
or
pm.collectionVariables.set(“url”, response.results[0].links[0].url);
and various variations of this.
I feel like I’m so close, but can’t figure it out.
I’ve googled around for things like “extract property JSON” and “select key value pair in JSON with javascript”, to no avail.
Any help is welcome. Thank you!