class JSON::ParserError
This exception is raised if a parser error occurs.
This exception is raised if a parser error occurs.
Attributes
Column number where the parser encountered an error. Is nil when raised by JSON::ResumableParser.
Line number where the parser encountered an error. Is nil when raised by JSON::ResumableParser.
Public Instance Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/json-3.0.0/lib/json/common.rb, line 161 def json_path return @json_path if String === @json_path if Array === @json_path path = build_json_path(@json_path) @json_path = path unless frozen? return path end end
Returns a best effort JSONPath string representing where in the document the parser encountered an error:
begin JSON.parse('{"articles": [ { "title": invalid } ]}') rescue JSON::ParserError => error error.json_path # => "$.articles[0].title" end