I’m having a problem with JSONParser. I read a file from flash which has been previously encoded with JSONencoder. The structure is a simple array of tables which seems to be properly encoded in the flash file.
[{“ssid”:“Guest”,“pw”:"",“preferred”:true},{“ssid”:“ASUS_2G”,“pw”:“141366302*jdk”,“preferred”:false},{“ssid”:“ArchSolar~Buxton”,“pw”:“archsolar”,“preferred”:false},{“ssid”:“LRFF Wi-Fi 2”,“pw”:"",“preferred”:false},{“ssid”:“Olivia’s Garden”,“pw”:“mainelyhydroponics”,“preferred”:false},{“ssid”:“Olivia’s Garden_EXT”,“pw”:“mainelyhydroponics”,“preferred”:false},{“ssid”:“Pineland_Internal”,“pw”:"?",“preferred”:false},{“ssid”:“PF-Creamery”,“pw”:"?",“preferred”:false},{“ssid”:“Pineland-Market”,“pw”:"?",“preferred”:false},{“ssid”:“Mills2017”,“pw”:"?",“preferred”:false}]
But feeding this same string (as J_str) into JSONParser
nv_wifi <- sffs.open(“wifi_list.nv”,“r”)
J_str = nv_wifi.read()
test_array = JSONParser.parse(J_str)
kicks out the error:
2018-03-06 10:49:37 -05:00|[Device]|ERROR: the index ‘slice’ does not exist
2018-03-06 10:49:37 -05:00|[Device]|ERROR: in parse …imp#jsonparser.class.nut#1.0.0:285
Any suggestions where to look? It appears from the code example on the documentation page that the ’ " ’ need to be escaped. But if that were the case, shouldn’t JSONEncode do that? I don’t believe an escaped quote is standard JSON.
Maybe I’m on the wrong track?