Postman 邮递员-无法从属性键中包含“:”的对象中获取值

Postman 邮递员-无法从属性键中包含“:”的对象中获取值,postman,Postman,我正在努力从属性的键名中包含:的对象中获取值 这就是我的反应体的样子: { "links": { "content": { "href": "http://*********", "templated": false, "type": "application/hal+json" }, "test:search": [ {

我正在努力从属性的键名中包含
的对象中获取值

这就是我的反应体的样子:

{
    "links": {
        "content": {
            "href": "http://*********",
            "templated": false,
            "type": "application/hal+json"
        },
        "test:search": [
            {
                "title": "Some title",
                "href": "http://*************",
                "type": "application/hal+json"
            }
        ]
    }
}
当我试图从
test:search
获取
href
值时,邮差给了我一个错误:

“失踪”;“在陈述之前”


如果您将其添加到
测试
选项卡中,则此功能应能正常工作:

_.each(pm.response.json().links['test:search'], (item) => {
    console.log(item.href)
    pm.environment.set('href', item.href)
})

如果您要使用它来引用属性
pm.response.json().links.test:search
,它将无法设置变量


它可以工作!!非常感谢。我已经试着解决这个问题好几个小时了。你让我开心:D