I have the following let data which outputs the following JSON:
{
"OP_LC_check": [
0
],
"OP_LG_check": [
0
],
"LY_LC_check": [
5374
],
"LY_GC_check": [
6086
],
"ACT_LC_check": [
5299
],
"ACT_GC_check": [
3241
],
"ACT_GC_AT_OP_check": [
2980
],
"ACT_GC_AT_LY_check": [
3093
]
}
I want to add the values of each item to an array (dynamically) to get this output: [0, 0, 5374 ,6086, 5299,...]
Thank you
I have tried multiple things but can´t figure it out
Object.values(yourObject).flat(). If guaranteed order is important:[ "OP_LC_check", "OP_LG_check", "LY_LC_check", "LY_GC_check", "ACT_LC_check", "ACT_GC_check", "ACT_GC_AT_OP_check", "ACT_GC_AT_LY_check" ].map((key) => yourObject[key][0]).