I want to change a json array keys names from upper case letters to a lower case keys as the following
[
{
"_id": "581f2749fb9b6f22308f5063",
"WorkshopId": "1",
"WorkshopTitle": "workshop1",
"WorkshopPrice": "200",
"WorkshopDescription": "workshop1 is a test workshop",
"FloorNumber": "1",
"RoomNumber": "205",
"WorkshopLanguage": "english language",
"LastOnlineRegistrationDate": "15/10/2016",
"WorkshopDate": "1/11/2016",
"WorkshopStartTime": "8:00 AM",
"WorkshopEndTime": "11:00 AM",
"WorkshopRules": "Rules will be mentioned here",
"WorkshopCapacity": "200",
"Speaker": {
"SpeakerName": "John doe",
"AboutSpeaker": "About the speaker"
}
},
{
"_id": "581f27e796915434f44cd678",
"WorkshopId": "2",
"WorkshopTitle": "workshop2",
"WorkshopPrice": "200",
"WorkshopDescription": "workshop2 is a test workshop",
"FloorNumber": "1",
"RoomNumber": "205",
"WorkshopLanguage": "english language",
"LastOnlineRegistrationDate": "15/10/2016",
"WorkshopDate": "1/11/2016",
"WorkshopStartTime": "11:00 AM",
"WorkshopEndTime": "02:00 PM",
"WorkshopRules": "Rules will be mentioned here",
"WorkshopCapacity": "200",
"Speaker": {
"SpeakerName": "Jane doe",
"AboutSpeaker": "Jane doe - About the speaker"
}
}
]
for example WorkshopId must be changed to workshopid, I have a function in node js that query a collection in mongodb and return the json :
getWorkshops: function (db, response) {
db.collection('Workshops').find().toArray(function (err, results) {
var convertedArr = [];
//convert the json.
response.send(JSON.stringify(convertedArr));
});
any help?