• Hello,

    I recently upgraded my Bangle1 to 2v20 and discovered that the writeJSON optimization that skips quotes on alphanumeric field names broke my apps. My use case is probably uncommon but I thought I'd mention the workaround I came up with just in case it ever helps anybody else.

    Basically, I gather data on my Bangle and save it to JSON formatted files. Using the IDE I export the files to my computer, then import them back into the Bangle emulator. I then run different Bangle apps in the emulator to graph the data (and take screenshots of the graphs).

    Anyway, starting with 2v20, writeJSON skips the quotes on alphanumeric field names and because of this, when I used readJSON in the emulator to load the files imported from my Bangle I got a syntax error complaining about the missing quotes. I guess it would be nice for there to be an option added to writeJSON to still include the quotes but until then a simple workaround is just to use write("filename", JSON.stringify("json value")) in lieu of writeJSON("filename", "json value").

    I've uploaded a sample script to replicate the problem with my workaround commented out.

    As always, many thanks to Gordon and the Espruino team for all their amazing and wonderful work!

    1 Attachment


Avatar for TTBangler @TTBangler started