I have a JSON Object with an infinite level of objects inside. I want to frame a JSON Array where it contains the first key in a key and all the associated value in another key.
For eg, The JSON I am having is below,
{
doingnow: {
"action items": { "open": { "child"....}, "In Progress": { "child"....}, "Completed": { "child"....} },
"financial": { "q1": { "jan 2017": { "child"... }, "feb 2017": {....} }, q2: {... }, q3: {... },....}
},
finished: { "discarded": {... } },
.........
}
But the actual JSON Array which I am expecting
[{
key: "doingnow": children: [{
key: "action items", children: [{ key: "open", children: [] }, { key: "In Progress", children: [] }, { key: "Completed", children: [] }],
key: "financial", children: [{ key: q1, children: [{ key: "jan 2017", children: [] }, { key: "feb 2017", children: [] }] },
{ key: q2, children: [{ key: "jan 2017", children: [] }, { key: "feb 2017", children: [] }] }]
}],
}, { key: "finished", children: [{ ...}] }
Can anyone help me with this? Working on it for 2 days. :-(