JSON is great. JSON parsers are not. They punish you for every missing
quote and misplaced comma. You're a professional -- you know what you
meant. jsonic knows too.
a:1,foo:bar → {"a": 1, "foo": "bar"}
It's a JSON parser that isn't strict. And it's very, very extensible.
More than you'd expect. All of the following parse to {"a": 1, "b": "B"}:
a:1,b:B
a:1b:B
a:1// a:2# a:3/* b wants * to B */b:B
{ "a": 100e-2, '\u0062':`\x42`, }
That last one mixes double quotes, single quotes, backticks, unicode
escapes, hex escapes, and scientific notation. It doesn't matter. jsonic
handles it.
You might be tempted to think a lenient parser is a simple thing. It
isn't. jsonic is built around a rule-based parser and a matcher-based
lexer. Both are fully customizable through options and plugins. You can
change almost anything about how parsing works -- and you don't have to
understand the internals to do it.
Options
Let's start simple. Create a configured instance with Jsonic.make():
Consider what just happened: we invented a new syntax element (~),
told the parser what to do when it encounters one, and wired it up with
a configurable value. The parser itself doesn't care what symbols you
use. It only cares about rules.
There's a Go port with the same core parsing behavior. Same syntax,
same relaxations, same results. See the Go documentation for
installation and usage.