• I know that this conversation is in the 8266 realm, but - for curiosity - I just tested on a PICO, and that is what I get:

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v04 (c) 2019 G.Williams
    Found PICO_R1_3, 2v04
    >
    Connected to /dev/cu.usbmodem14111
    >JSON.parse()
    Uncaught SyntaxError: Expecting a valid value, got undefined
     at line 1 col 10
    undefined
             ^
    > JSON.parse(undefined)
    Uncaught SyntaxError: Expecting a valid value, got undefined
     at line 1 col 7
    undefined
          ^
    >JSON.parse("")
    Uncaught SyntaxError: Expecting a valid value, got EOF
     at line 1 col 1
    ^
    >JSON.parse("{}");
    ={  }
    > 
    

    ...comparable what the (Chrome) browser JS Engine throws at me: see attached screen shot (...but is for sure not a crash of the system / HW).

    Workaround is asking if undefined before parsing... (try catch does not help)...


    1 Attachment

    • JSON_parse_sth.png
About

Avatar for allObjects @allObjects started