A simple JSON parser written with kpeg.
Ruby
Switch branches/tags
Nothing to show
Latest commit f90ec39 May 17, 2011
Twisol Fix lack of EOF check for root rule. Without an EOF check, the parser…
… will parse "[1, 2, 3]invalidstuff" as valid.

README.md

A simple (but complete) JSON parser written using Evan Phoenix's kpeg.

By default, json-kpeg will accept any valid JSON value as the root value. To enable strict parsing (array or object only as root), set parser.strict = true before calling #parse.

Example

require "json-kpeg"

parser = JsonKpeg::Parser.new("[1, 2, 3]")
if parser.parse
  p parser.result
else
  parser.show_error
end