How to reproduce the JSON::ParserError. Go to rails console:
$rails c
Loading development environment (Rails 4.2.6)
> JSON.parse(nil)
TypeError: no implicit conversion of nil into String
from /Users/bparanj/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/json/common.rb:156:in `initialize'
> JSON.parse({})
TypeError: no implicit conversion of Hash into String
from /Users/bparanj/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/json/common.rb:156:in `initialize'
> JSON.parse('')
JSON::ParserError: A JSON text must at least contain two octets!
from /Users/bparanj/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/json/common.rb:156:in `initialize'
!!!
ReplyDelete