Project

General

Profile

Actions

Bug #12951

closed

JSON.parse allows invalid string escapes

Added by mmb (Matthew Boedicker) over 7 years ago. Updated over 7 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
[ruby-core:78190]

Description

According to jq and jsonlint, the following JSON is invalid:

{"x":"\$"}

but JSON.parse will parse it without complaint:

irb(main):002:0> JSON.parse('{"x":"\$"}')
=> {"x"=>"$"}

Updated by shyouhei (Shyouhei Urabe) over 7 years ago

  • Status changed from Open to Third Party's Issue

It is a very delicate question if this is a bug. According to RFC7159 section 9 https://tools.ietf.org/html/rfc7159#section-9, a JSON parser is explicitly allowed to extend JSON. So this could perhaps be an extension made by the JSON parser.

Besides that JSON is maintained in a separate repo so please report there https://github.com/flori/json

Actions

Also available in: Atom PDF

Like0
Like0