I'm using node-webkit to build an app that alerts me every time there is an alarm in my country (we are currently in a war). There is a website that supplies a JSON file that contains info about current alarms.
When I try to access that page and check whether there are alarms, the result is a lot of question marks. I can't use that, and when I try to JSON.parse the data it says that it cannot parse question marks. What do I do?
url: "http://www.oref.org.il/WarningMessages/alerts.json",
checkAlert: function(callback) {
request({
uri: this.url,
json: true,
encoding: 'utf-8'
}, function(err, res, json) {
if (err)
return console.log(err);
json = JSON.parse(json);
var data = json.data;
console.log('just checked. json.data: ' + data);
if (data.length != 0) // if array is not empty
callback(true);
else
callback(false);
});
}
Here's how the file looks like:
{
"id" : "1405751634717",
"title" : "something in hebrew ",
"data" : []
}
Thanks a lot!