Open Sirishadg opened 5 years ago
your desired output is not a valid json. Now, regarding your issue, if what you need is just remove one layer of array. It's not too complicated as your outer array only has one item in it which is the inner array. So we can unwrap it directly
Hi,
I'm trying to convert nested arrays into objects. I want offsets out of this nested arrays. so that I can split the offsets using splitjson. could you please help me with the jolt transform.
this is my input JSON file:
[[{ "offsets" : [ { "end" : 1, "level" : null, "start" : 2 } ], "new_id" : 1.0 }, { "offsets" : [ { "end" : 3, "level" : 1, "start" : 6 }, { "end" : 20, "level" : null, "start" : 30 }, { "end" : 1, "level" : 1, "start" : 1 } ], "new_id" : 1.0 }]]
Desired Output
{ "offsets" : [ { "end" : 1, "level" : null, "start" : 2 } ], "new_id" : 1.0 }}
{ offsets" : [ { "end" : 3, "level" : 1, "start" : 6 }, { "end" : 20, "level" : null, "start" : 30 }, { "end" : 1, "level" : 1, "start" : 1 } ], "new_id" : 1.0 }