Pin in JSON ?

Posted on
  • Brought the problem down the bottom.
    Don't know, what standard tells about this.
    If a port cannot be recognized, thats ok, but I would expect to get an error message.

    >var x = {port:C5};
    ={ "port": C5 }
    >var j = JSON.stringify(x);
    >var y = JSON.parse(j);
  • Yes, that's odd - it seems like JSON.parse should really produce an exception. Could you file a bug for it on GitHub?

    The whole parsing thing is annoying. It did work, and then someone raised a bug because it worked when it should have failed, and that could have been a security bug - maybe. So I had to disable it :(

    So if you care about stuff like that, now you have to use eval - but if you do that then you need to be sure you trust your source of data :)

  • Is this because C5 has special meaning? Would it work with an int or string?

  • Yes, ints and strings are fine. If it was being spec compliant, JSON.stringify should really replace it with undefined I believe.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Pin in JSON ?

Posted by Avatar for JumJum @JumJum