If I have a json object, and I don't really know how complex it is, I would like to restructure it as following example, how can I write it in Javascript?
Assume that I have a json object as following:
{
"a": 1,
"b": {
"c": 2,
"d": {
"e": 3
}
}
"f": {
"g": 4
}
}
Now, I would like to have following expected result:
{
"a": 1,
"b.c": 2,
"b.d.e": 3,
"f.g": 4
}