i have a json object data in the below format. In that i need to insert some new record after particular id.
[
{
"id":"1",
"name":"one",
"children":[
{
"id":"4",
"name":"four",
"children":[
]
},
{
"id":"5",
"name":"five",
"children":[
]
},
{
"id":"6",
"name":"six",
"children":[
]
}
]
}
]
For Ex: i have a id as 5 and also new JSON object({"id":"new data","name":"new data","children":[]}) as well. then the new data should insert after id 5. Is there any possible way to insertafter some particular id.
[
{
"id":"1",
"name":"one",
"children":[
{
"id":"4",
"name":"four",
"children":[
]
},
{
"id":"5",
"name":"five",
"children":[
]
},
{
"id":"new data",
"name":"new data",
"children":[
]
},
{
"id":"6",
"name":"six",
"children":[
]
}
]
}
]