You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In jsmn, values are considered children of their key. (More specifically, the key has size 1, and the value's parent link points to the key).
This is fine in strict mode, but in non-strict mode, where arrays and objects can be keys, this is not so clean. In practice, the way this is implemented, whenever a value is parsed, it is made a child of the last token parsed.
Normally, this just means the last string/primitive token in an array/object used as a key will mistakenly have a size of 1. Not correct, but normally, the size of strings and primitives is ignored, so not a big deal.
However, if an empty array is used as a key, the parser makes more significant mistakes. For example, the following input:
{
[]: "value1",
"key2": "value2"
}
produces output equivalent to this:
{
[
'value1',
'key2'
]: 'value2'
}
The text was updated successfully, but these errors were encountered:
In jsmn, values are considered children of their key. (More specifically, the key has size 1, and the value's parent link points to the key).
This is fine in strict mode, but in non-strict mode, where arrays and objects can be keys, this is not so clean. In practice, the way this is implemented, whenever a value is parsed, it is made a child of the last token parsed.
Normally, this just means the last string/primitive token in an array/object used as a key will mistakenly have a size of 1. Not correct, but normally, the size of strings and primitives is ignored, so not a big deal.
However, if an empty array is used as a key, the parser makes more significant mistakes. For example, the following input:
produces output equivalent to this:
The text was updated successfully, but these errors were encountered: