brianmario/yajl-ruby

Parsing fails after previous parsing error

achikin opened this issue · 0 comments

require 'yajl'
p = Yajl::Parser.new
#Let's parse something invalid
p.parse("{\"a\": '0'}")
Yajl::ParseError: lexical error: invalid char in json text.
                                 {"a": '0'}
                     (right here) ------^
#Allright, let's try a valid json now
p.parse("{\"a\": 0}")
Yajl::ParseError: lexical error: invalid char in json text.
                                        {"a": 0}
                     (right here) ------^

Maybe I don't understand and Yajl::Parser is kind of single-shot and I should recreate it every time I want to parse something?