Json to multiple items

Hi there,
I have a function node with this code:

return {
“mdmDisableVolumeButtons”: false,
“playMedia”: false,
“actionBarFgColor”: -1,
“deleteHistoryOnReload”: false,
“wifiSSID”: “”,
“actionBarBgUrl”: “”,
“mdmApkToInstall”: “”,
“mdmDisableADB”: true
};

Now I want to split this so that each key: value was a single item.

Using Object.keys, you can explode out each property as it’s own object like this:

const a = {
  “mdmDisableVolumeButtons”: false,
  “playMedia”: false,
  “actionBarFgColor”: -1,
  “deleteHistoryOnReload”: false,
  “wifiSSID”: “”,
  “actionBarBgUrl”: “”,
  “mdmApkToInstall”: “”,
  “mdmDisableADB”: true
};

return Object.keys(a).map(key => ({ [key]: a[key] }));
1 Like