This project is read-only.
3
Vote

JSON.parse not working

description

it "can parse JSON" do
    require 'json'
    JSON.parse String.new('{"name": "value"}')
end
 
Fails with the following when executed:

can parse JSON
 Failure/Error: JSON.parse String.new('{"name": "value"}')
 JSON::ParserError:
   unexpected token in object at '"name": "value"}'!
 # C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/json/common.rb:146:in `parse'
 # ./ruby/spec/go_artifacts_spec.rb:16
 
This is using IronRuby 1.1.3

comments

thomo13 wrote Sep 7, 2011 at 3:25 AM

I'm also seeing the same issue

wrote Dec 4, 2012 at 8:57 PM

pianoroy wrote Dec 4, 2012 at 9:01 PM

This is pretty bad. I was forced to use a hand-rolled solution for JSON parsing in IronRuby.

wrote Feb 22, 2013 at 12:39 AM

adamreeves wrote Apr 13, 2014 at 4:50 AM

Since it appears that IronRuby is a dead project, here's a work around for this bug:
JSON::Pure::Parser::STRING = /"((?:[^\x0-\x1f"\] | \["\\/bfnrt] | \u[0-9a-fA-F]{4} | \[\x20-\xff])*)"/x