Nimony

The road to Nim 3

parsejson

nimony/lib/std/parsejson.nim

This module implements a json parser. It is used and exported by the json standard library module, but can also be used in its own right.

This is a port of Nim's std/parsejson to Nimony. It keeps the original design: JsonParser inherits from lexbase.BaseLexer, so it parses straight off a Stream with a fixed-size, sentinel-terminated buffer (good for embedded / streaming use) instead of slurping the whole input. Because Nimony models exceptions as ErrorCode values (without an attached message), the JsonKindError/JsonParsingError exception types are gone: raiseParseErr raises a plain ValueError. The helpful message is still available through errorMsg/errorMsgExpected.