I want to get the value by the key of this json. The key is description and i want it in my console.log, i don't really get how to get this value, the filtering before worked fine.
{
"id": "149",
"description": "Try"
}
Thanks!
First You need to parse it using JSON.parse. Then using . or [] you can access. For Ex:-
var a = '{
"id": "149",
"description": "Try"
}'
b = JSON.parse(a)
b['description'] or b.description FOr more reference you can study here
const dummy = {
id : '1',
description : 'Wow awesome'
};
console.log(dummy.description);
//-------------------------------------
const descData = dummy.description;
console.log(descData);
variableName['description'] or variableName.description
treeNodes.description OR var data = JSON.parse(treeNodes); console.log(data.description);