Crate sn[][src]

sn

sn is a minimalistic and simple Rust JSON parser.
sn operates by borrowing slices of the input string, meaning no data is copied during the parsing process, which helps improve efficiency.

WIP

This library is still in a very early working state and is subject to change a lot as it matures. Use At Your Own Risk.

Bytes

Bytes is a struct used internally to represent string slices, encoded as &u8. The primary use case for this struct is the Debug implementation, which converts the contents to a string.

Examples

Loading a JSON file from the filesystem and parsing it into a Value:

use sn::Parser;

let raw_json = r#"{ "a": [1, 2, 3], "b": null }"#;
let mut parser = Parser::new(raw_json.as_bytes());
let parsed_json = parser.parse();

println!("{:?}", parsed_json);

Usage

Add sn to your Cargo.toml:

[dependencies]
sn = "0.1.2"

Structs

Parser

The parser itself. Create a new parser with the new method, and parse it using the parse method.

Stream

A data stream. Used by the Parser to iterate over the supplied JSON data and to parse it into Values.

Enums

ParseError

An error returned by the parser in the event that the input JSON is malformed.

Value

A value as represented in parsed JSON.