Reputation: 321
I have code that returns an array in json format but I want it to be under "data": So right now, it shows as:
"["newDate": 'test'": 'test',"attendees": 'test,"name": 'Foo']"
How do I get it as: "{ data: ["newDate": 'test'": 'test',"attendees": 'test,"name": 'Foo'] }"
let countries = [];
for (x in newObj) {
countries.push({
"newDate": newObj[x][0],
"count": getDates()[x].length,
"attendees": getDates()[x],
"name": x
})
}
return JSON.stringify(countries);
Upvotes: 0
Views: 151