The following is the data from the source file:
{
"dubbuseqchapter+block@a7a5931f68d0482eaff2b7c9f9684e47": {
"category": "chapter",
"children": [
"dubbuseqsequential+block@968513c8f0cc4249b7cfc2290ac967dc",
"dubbuseqsequential+block@f7f730a478144a74bd127f996d6dc4f5",
"dubbuseqsequential+block@91a0d5d7cd9649a3bdf057400e0a1c96",
"dubbuseqsequential+block@28b2b171b6734b13af29735796c5ad5a",
"dubbuseqsequential+block@192a150c8aab43b9bd236773ba60b414",
"dubbuseqsequential+block@26b3464dad42460ea66f9afe89770065"
],
"metadata": {
"display_name": "Introduction course orientation"
}
},
"dubbuseqchapter+block@b2451e9195c5466db8b66f53ed06c9fd": {
"category": "chapter",
"children": [
"dubbuseqsequential+block@c95826a16f71405ba58319d23d250fc4",
"dubbuseqsequential+block@fe4e3b8b7cdd4fa0b9fe9090223b7125",
"dubbuseqsequential+block@44bbdee625dc465ebe725d2126ed0662",
"dubbuseqsequential+block@8d4daba07d4443f3b2a0b2506280ee2c",
"dubbuseqsequential+block@c68d9d3ba7de45b1b0770085e4f1f286",
"dubbuseqsequential+block@ccdca5b2aca94dbdabb3a57a75adf3fa"
],
"metadata": {
"display_name": "Module closing section"
}
}
}
The following javascript brings the top key values (i.e dubbuseqchapter+block@a7a5931f68d0482eaff2b7c9f9684e47,dubbuseqchapter+block@b2451e9195c5466db8b66f53ed06c9fd )
Javascript code
var obj = JSON.parse(jContent);
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
var row = createRowCopy(getOutputRowMeta().size());
var idx = getInputRowMeta().size();
row[idx++] = keys[i];
// Alert (keys.length);
putRow(row);
}
However, I am unable to get the values of the keys..(i.e. Category, Children and metadata) in this example.
I have tried Objects.values() but it returns null or object object in the Alert.