首页 > 解决方案 > How to access HTML tag in json object

问题描述

enter image description here I have JSON object and I want to access "content" which I have highlighted in the s2 snapshot so currently this is the situation "content": "". So if I place some div or some anchor tag in the content something like that "content": " " So How to access this url i.e href . Any help will be highly appreciated.

标签: javascripthtml

解决方案


var obj = {
    "key": "value",
  "array": [{ 
    "id": "123456",
    "body": {
        "content": "<tag></tag>"
    }
  }],
}

console.log(obj.array[0].body.content);


推荐阅读