I have a simple REST application built in Sails and I want to save the correct data in a model attribute of type array
.
Route to post
http://localhost:1337/locations/create?name=savassibeer&locations={latitude:23789472398.2344,longitude:2734637892.56756756}&locations={latitude:22.2344,longitude:2562.56756756,date:2014-02-15T11:00:00}
The result
{
name: "savassibeer",
locations: [
"{latitude:23789472398.2344,longitude:2734637892.56756756}",
"{latitude:22.2344,longitude:2562.56756756,date:2014-02-15T21:49:23.084Z}"
],
createdAt: "2014-02-15T21:49:23.084Z",
updatedAt: "2014-02-15T21:49:23.084Z",
id: "52ffe0e345d19ec72b4fac77"
}
How can I transform the strings in locations
to a valid JSON Object and save it?