bennu-json
This is a JSON parser for the Bennu parser combinator library. This module is good for:
- working in places where the native
JSON.parse
function is not available (though other polyfills may be more performant). - parsing JSON incrementally.
- being an example of how to use parser combinators and the Bennu library.
Usage
This module exports parsers for json
, array
, object
, number
, and
string
. Using the json parser to parse strings into objects requires using
the Bennu library.
var bennu = ;var json = json; { return bennuparse;} console;// { a: [ -5.12e+100, null ] }
You can also do incremental parsing with Bennu:
var bennu = ;var json = json; var s1 = bennuincremental;var s2 = bennuincremental;var s3 = bennuincremental;console;// [ 123, 456, 789 ]