jsmn
jsmn copied to clipboard
Empty array element parsing
I found out that parsing the string "[a,,b]" produces an array with 2 elements, while a browser interprets it as a 3-element array, where the second is undefined. I don't know if you will find this useful, but i wrote a patch to parse the empty second array element as an empty string.
- Bitbucket: https://bitbucket.org/zserge/jsmn/issue/41
- Originally reported by: Anonymous
- Originally created at: 2014-12-02T16:00:40.825
Parsing such array as 3 elements is definitely incorrect, in browser as well:
JSON.parse('[1,,3]')
SyntaxError: JSON.parse: unexpected character at line 1 column 4 of the JSON data
The fact that it works in strict mode is a bug.
Related to #52