Using JavaScript; how do I produce this output
cell
work (123) 456 7890
from this valid json
{"phone": [
{
"@attributes": {
"type": "cell",
"ext": ""
}
}, "(123) 456 7890", {
"@attributes": {
"type": "work",
"ext": ""
}
}
]}
In a very narrow sense, you’d need to do this
But the structure of that JSON data may change, so you can’t rely on the 0/1 indexes, and anyway the structure is weird. Like the comments say, if it comes from XML, then parse that instead