Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActiveSupport JSON decode fails on "\\" at end of string

#2836

The following JSON string is not corrected decoded by ActiveSupport::JSON.decode:

{"a","1\"}

This string is correctly parsed by the json gem. A patch with a failing test is included.

Reported by Erik Andrejko · June 25th, 2009 @ 03:42 PM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Yehuda Katz (wycats)
    Yehuda Katz (wycats)
    • State changed from new to invalid

    This is an invalid JSON object. JSON key/value pairs are required to be enclosed in {}, and JSON Arrays are required to be enclosed in [].

    July 2nd, 2009 @ 07:38 PM

  2. Erik Andrejko
    Erik Andrejko

    That was a typo. The JSON string, as is in the test, should be:

    {"a" : "1"}

    I believe that the ActiveSupport JSON parser will fail for any value which ends in "".

    July 3rd, 2009 @ 01:06 AM