Reputation: 43
I'm struggling to get value from an object that has :
within the key name of property.
This is how my Response Body looks:
{
"links": {
"content": {
"href": "http://*********",
"templated": false,
"type": "application/hal+json"
},
"test:search": [
{
"title": "Some title",
"href": "http://*************",
"type": "application/hal+json"
}
]
}
}
When I try to get the href
value from test:search
, Postman is giving me an error:
"Missing ";" before statement".
Upvotes: 4
Views: 410
Reputation: 25881
This should work if you add it to the Tests
tab:
_.each(pm.response.json().links['test:search'], (item) => {
console.log(item.href)
pm.environment.set('href', item.href)
})
If you were to use this to reference the property pm.response.json().links.test:search
it would fail to set the variable.
Upvotes: 1