I am struggling with extracting data from a JSON string that looks like this:
var txt= '{“group”: [
{“family1”: {
“firstname”:”child1”,
“secondname”:”chlid2”
}},
{“family2”: {
“firstname”:”child3”,
“secondname”:”child4”
}}
]}';
When I try to access the information such as "child1" using the code below, it seems like something is not working properly:
alert (group[0].family[0].firstname);
Unfortunately, I am not getting any response. It might be due to a syntax error or perhaps an issue with my implementation. Any assistance would be greatly appreciated.