Open san29-commits opened 3 years ago
Hi, I am in need to add a id to a output json while converting array of array into a single array. Please help.
Input Json:
{ "Beverages" : { "Items" : [ { "name" : "cofee", "type" : "hot" },{ "name" : "wine", "type" : "cold" },{ "name" : "tea", "type" : "hot" },{ "name" : "beer", "type" : "cold" } ] }, "Snacks" : { "Items" : [ { "name" : "crackers", "type" : "hot" },{ "name" : "salad", "type" : "cold" },{ "name" : "muffin", "type" : "cold" },{ "name" : "toast", "type" : "hot" } ] } }
And, the expected output is:
{ "items" : [{ "name" : "cofee", "type" : "hot", "hotId" : 1 },{ "name" : "wine", "type" : "cold", "coldId" : 1 },{ "name" : "tea", "type" : "hot", "hotId" : 2 },{ "name" : "beer", "type" : "cold", "coldId" : 2 },{ "name" : "crackers", "type" : "hot", "hotId" : 3 },{ "name" : "salad", "type" : "cold", "coldId" : 3 },{ "name" : "muffin", "type" : "cold", "coldId" : 4 },{ "name" : "toast", "type" : "hot", "hotId" : 4 } ] }
As above, the hotId and coldId are the new fields in the output. But, it increments.
@milosimpson , please help
Hi, I am in need to add a id to a output json while converting array of array into a single array. Please help.
Input Json:
And, the expected output is:
As above, the hotId and coldId are the new fields in the output. But, it increments.