I have the json data in array.
var obj = [
{
student_data:{
name: 'brj',
id: '123',
marks:[{'hi': 12, 'mt': 20, 'en': 20}]
}
},
{
student_data:{
name: 'anand',
id: '124',
marks:[{'hi': 12, 'mt': 20, 'en': 20}]
}
}
]
here i want to replace student_data
with their respective ids
, and convert this array to json string. Also i would like to remove some of the fields like id
which we are have used already in place of student_data
. the output should look like
{
'123':{
name: 'brj',
marks:[{'hi': 12, 'mt': 20, 'en': 20}]
}
},
{
'124':{
name: 'anand',
marks:[{'hi': 12, 'mt': 20, 'en': 20}]
}
}