I am unable to access a json value
{\"phone\": [
{
\"@attributes\": {
\"type\": \"cell\",
\"ext\": \"\"
}
}, \"(123) 456 7890\", {
\"
actually your json structure is not perfect, so here is the solution for your desired output
var json = {"phone": [
{
"@attributes": {
"type": "cell",
"ext": ""
}
}, "(123) 456 7890", {
"@attributes": {
"type": "work",
"ext": ""
}
}
]};
console.log(json['phone'][0]['@attributes'].type);
console.log('
'+json['phone'][1]);
console.log('
'+json['phone'][2]['@attributes'].type);