Technology Errors

json/common.rb:122:in `parse’: 574: unexpected token at ” (JSON::ParserError)

I have been writing some scripts in ruby to parse JSON generated data. To do this it requires the json ruby gem which works great to parse through JSON output. Anyhow I was loading files into ruby and parsing them without issue until i got to a larger file and I received the below error.

/usr/local/lib/ruby/gems/1.8/gems/json-1.1.3/lib/json/common.rb:122:in `parse’: 574: unexpected token at ” (JSON::ParserError)
from /usr/local/lib/ruby/gems/1.8/gems/json-1.1.3/lib/json/common.rb:122:in `parse’
from tickets.rb:13
from tickets.rb:11:in `open’
from tickets.rb:11

Technology Insights

Install Ruby JSON Gem on Windows

When attempting to install the Ruby JSON gem on Windows you are most likely going to get an error similar to the below. The trick is to instead install json_pure gem using the syntax listed below the error.



  1. C:\>gem install json
  2. Building native extensions. This could take a while...
  3. ERROR: Error installing json:
  4. ERROR: Failed to build gem native extension.
  6. C:/ruby/bin/ruby.exe extconf.rb install json
  7. creating Makefile
  9. nmake
  10. 'nmake' is not recognized as an internal or external command, operable program or batch file.
  12. Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/json-1.1.3 for inspection.
  13. Results logged to C:/ruby/lib/ruby/gems/1.8/gems/json-1.1.3/ext/json/ext/parser/gem_make.out