#json #parser


Simple JSON parser for Rust

1 unstable release

0.1.22 May 12, 2023
0.1.21 May 10, 2023
0.1.15 Apr 29, 2023

#846 in Parser implementations

Download history 4/week @ 2023-06-02 24/week @ 2023-06-09 48/week @ 2023-06-16 28/week @ 2023-06-23 7/week @ 2023-06-30 4/week @ 2023-07-07 3/week @ 2023-07-14 9/week @ 2023-07-21 4/week @ 2023-07-28 50/week @ 2023-08-04 4/week @ 2023-08-11 27/week @ 2023-08-18 25/week @ 2023-08-25 27/week @ 2023-09-01 30/week @ 2023-09-08 6/week @ 2023-09-15

89 downloads per month
Used in chiselj







Another JSON Parser?

The Chisel JSON parser aims to be a relatively simple DOM and SAX parser for JSON, that does not include all the machinery required to support explicit serialisation from, and deserialisation into structs/enums within Rust.

It's a simple little parser that is intended to allow you to choose how you want to parse a lump of cursed JSON, and then either build/transform a DOM into a richer AST structure, or alternatively just cherry-pick the useful bits of the payload via closures which are called in response to SAX parsing events.

(Because let's face it, JSON payloads usually come burdened with a whole load of unnecessary crap that you'll never use).

Crate Feature Flags

There currently defined features within the crate are as follows:

Feature Description Default Feature?
mixed_numerics Should numbers be parsed separately as i64 and f64? yerp


There are several examples provided as part of the source:

Example Description
distinct_pointers Extract all distinct JSON pointers using the SAX parser
distinct_object_pointers Extract all object JSON pointers using the SAX parser

Build & Test

In order to build locally you can just use the standard cargo build command and associated variants, however there is also a supplementary Makefile.toml included in the source if you prefer to use cargo-make.

To regenerate the README.md file as you build - you should either use:

cargo make

or alternatively,

cargo readme > README.md

There are a number of benchmarks included based on the most excellent criterion within the source, which can be run using either the supplied benchmark.sh script, or alternatively by using the associated cargo make targets.