I have one JSON Object like this :
var myObject = [
{
\"Name\" : \"app1\",
\"id\" : \"1\",
\"groups\" : [
{ \"id\" : \"test1\",
I think this should work for you:-
var id = 'test1';
var newname = 'test grp45';
var numberOfGruops = 0;
myObject.forEach(function(app){
numberOfGruops += app.groups.length; //Count all groups in this app
app.groups.forEach(function(group){
if(group.id===id)
group.name = newname; // replace the name
});
});