I have array of JSON like
[
{title:'button'},
{title:'button'},
{title:'button'},
{title:'button'},
]
and want to convert it as
[
{title:'button 1'},
{title:'button 2'},
{title:'button 3'},
{title:'button 4'},
]
Advertisement
Answer
Try this please
var arrJson = [
{title:'button'},
{title:'button'},
{title:'button'},
{title:'button'},
] ,
arrJson.forEach((e,i)=>{
arrJson [i]['title'] = arrJson[i]['title'] + " " + i;
})