Can a nested array object be flattened into a single object? In my query, I aim to eliminate the source object and combine all properties into one object (see the desired output below).
var result = [
{"_id":"12345",
"_type":"feeds",
"_source":{
"title": "hi all solve it",
"link": "www.face.com",
"content": "Hi thewwewewedwe asdasdasdasd",
"createdAt": "2018-08-08T11:42:40.073Z",
"updatedAt": "2018-08-08T11:42:40.073Z",
"reply": []
}
}]
//desired output
var newResult = [
{
"_id":"12345",
"_type":"feeds",
"title": "hi all solve it",
"link": "www.face.com",
"content": "Hi thewwewewedwe asdasdasdasd",
"createdAt": "2018-08-08T11:42:40.073Z",
"updatedAt": "2018-08-08T11:42:40.073Z",
"reply": []
}];