JSFiddle - React, Tailwind, and code Playground
by Alexey Demin
JavaScript
const jsonText = `{
"Data": {
"42": {
"Id": "4321",
"ImageUrl": "/media/35650717/42.jpg",
"Symbol": "42",
"FullName": "42 Coin (42)"
},
"PRC": {
"Id": "3638",
"ImageUrl": "/media/20393/prc.png",
"Symbol": "PRC",
"FullName": "ProsperCoin (PRC)"
}
}
}`;
const json = JSON.parse(jsonText);
console.log(json.Data['SPY']?.FullName ?? 'SPY not found');
if(json.Data.hasOwnProperty('XPY')){
console.log('XPY: ' + json.Data['XPY'].FullName);
}