I have generate several one-liner JSON files(from excel) -which i attempted to read via the cordova mobile app. The file is being read but the problem is parsing it example onliner Json File: Note the file is being read
inside onloadend:
{"name":"Acrobat Ant","id":"500","category":"Ants","features":{"format": {"cn":"hd_lst" ,"fm":"inline","edit": 0},"npma":"1.Ants//13.Wood-infesting Insects","compare2":"","length":"Adults 2.5-4mm // Queen 10mm","color":"Brown to black // "... (this is only partial
Error in Success callbackId: File899903995 : SyntaxError: Unexpected token in JSON at position 72
cordova.js:310 SyntaxError: Unexpected token in JSON at position 72
at JSON.parse (<anonymous>)
at FileReader.reader.onloadend (plugins.js:188)
at FileReader.readSuccessCallback (plugins/cordova-plugin-file/www/FileReader.js:164)
at Object.callbackFromNative (cordova.js:291)
at <anonymous>:1:9
This happens to ever single file i try. That position 72 (for this file) is at the end of the {"format"
word just before the colon :
As i said this happens to every other file except the position changes but all fail exactly right at the end of the format property.
I used https://jslint.com/ to check the syntax of the one line JSON and it says is good. The curious thing is that if the one liner is changed to a layered format(via visual Code Shift-ALt-F) as the sample breakdown shown below the JSON gets parse with no problem.
{
"name": "Acrobat Ant",
"id": "500",
"category": "Ants",
"features": {
"format": {
"cn": "hd_lst",
"fm": "inline",
"edit": 0
},
....etc
By the way The one line JSON files were generated from Excel and saved as UTF8 Without BOM. (It fails if i try to parse used it WITH BOM.) So My dilemma is That I have over 200 files which I would like them to be read immediately once created without I having to do the manual extra step to turn them into a layered format JSON.
FYI I used exactly the suggestion on how to save excel data to UTF8 without BOM from VBA : save a file with UTF-8 without BOM
please advise