I ran into this problem, I was able to write solution which can handle array of object (not posted here) or one level deep nested object but i couldn\'t solve when the given
I am very late to the party but it can be easily achieved with a module like Flatify-obj.
Usage:
const flattenObject = require('flatify-obj'); flattenObject({foo: {bar: {unicorn: '