maciejhirsz / json-rust

JSON implementation in Rust
Apache License 2.0
563 stars 63 forks source link

Fails to correctly parse key with escaped forward slash #167

Closed alecembke-okta closed 4 years ago

alecembke-okta commented 4 years ago

When attempting to parse the following string:

{"a\/b":"c\"d\"e","f":1}

The following value is created:

{
  "a/b": null,
  "c\"d": "c\"d\"e",
  "f": 1
}

It seems the combination of the escaped forward slash and the escaped quote in the value causes the parser to fail to attach the value in the correct location.

alecembke-okta commented 4 years ago

At first I thought escaping forward slashes was incorrect, but it turns out it is allowed by the spec but isn't required:

escape
    '"'
    '\'
    '/'
    'b'
    'f'
    'n'
    'r'
    't'
    'u' hex hex hex hex