Is it possible to have multi-line strings in JSON?
It\'s mostly for visual comfort so I suppose I can just turn word wrap on in my editor, but I\'m just kinda curious
Try this, it also handles the single quote which is failed to parse by JSON.parse() method and also supports the UTF-8 character code.
parseJSON = function() {
var data = {};
var reader = new FileReader();
reader.onload = function() {
try {
data = JSON.parse(reader.result.replace(/'/g, "\""));
} catch (ex) {
console.log('error' + ex);
}
};
reader.readAsText(fileSelector_test[0].files[0], 'utf-8');
}