JSON - Access field named '*' asterisk

前端 未结 4 2167
南笙
南笙 2020-12-17 23:27

I am trying to access a field in a json object in javascript which has the key \'*\'. The jsonstring looks like this:

{\"parse\":
 {\"text\":
  {\"*\":\"text         


        
4条回答
  •  隐瞒了意图╮
    2020-12-17 23:55

    You could do:

    var json = {"parse":
     {"text":
      {"*":"text i want to access"}
     }
    }
    
    alert(json.parse.text['*']);
    

提交回复
热议问题