I am currently facing a challenge with parsing JSON data in my Parse Cloud function. After fetching the JSON file, I need to parse the data and populate one of my classes with the results. However, I'm having trouble figuring out how to properly parse the data before importing it. Can someone offer guidance on how to approach this parsing issue?
Here's an example of my Cloud function:
Parse.Cloud.define("hello1", function(request, response) {
return Parse.Cloud.httpRequest({
url: '{feed_url_here}',
params: {
'LastRequest':'0',
'SubscriberKey':'{access_key_here}',
}
}).then(function(httpResponse) {
response.success(httpResponse.text)
},
function (error) {
response.error("Error: " + error.code + " " + error.message);
}); });
An excerpt from the JSON data is provided below:
{"sports-content":{"sport-event":[{"event-metadata":{"league":"NHL Hockey","event-type":"0","league-details":"NHL","event-date-time":"12/03/2015 07:00 PM","eventNum":"2991830","status":"FINAL","off-the-board":"False"},"team":[{"team-metadata":{"alignment":"Home","nss":"2","openNum":"1","name":{"full":"New York Rangers"}},"wagering-stats":{"wagering-straight-spread":{"bookmaker-name":"CRIS","active":"true","line":"-1.5","money":"210","context":"current"},"wagering-moneyline":{"b...[truncated for brevity]