i have a json data as below, i wanted to add new entry to "revs" array if Item_id match, let say Item_id i was looking at is 1 and the existing json data consist of two item inside "revs" array, and wanted to add new entry
{
"Root" : [
{
"Item_Name" : "Test",
"Items" : [
{
"Item_id" : "1",
"revs" : [
{
"rev_id" : "1"
},
{
"rev_id" : "3"
},
{
"rev_id" : "need to add new entry here"
}
]
},
{
"Item_id" : "2",
"revs" : [
{
"rev_id" : "1"
}
]
}
]
}
]
}
i parse the json data like this
JObject jsonObject = JObject.Parse(<the json data above>);
iterate into "revs" array after Item_id matched and i create a JObject assiged to new entry data
JObject new_rev = new JObject();
new_rev["rev_id"] = "need to add new entry here"
what should i do to make my new_rev data reflect in jsonObject?
p/s: i use jsoncpp for C++ before and i just loop through with reference object and i can have modified json data into it easily
thanks.