Crate jsnom

Source
Expand description

§JSnom

A small and ergonomic parser library for JSON.

All parsers provided silently discard any of the string remaining after parser finishes.

§Example

use jsnom::JsonValue;

assert_eq!(
    JsonValue::from_str("[null, null, true]"),
    Ok(JsonValue::Array(vec![
        JsonValue::Null,
        JsonValue::Null,
        JsonValue::Bool(true)
    ]))
)

Structs§

Error
The error type returned from parsers. It is essentially a wrapper around nom::error::VerboseError using a different std::fmt::Display.

Enums§

JsonValue
Enum representing a parsed JSON input.

Functions§

parse
Parse a JsonValue from an input string.
parse_array
Parse a JsonValue::Array from an input string.
parse_bool
Parse a JsonValue::Bool from an input string.
parse_null
Parse a JsonValue::Null from an input string.
parse_number
Parse a JsonValue::Number from an input string.
parse_object
Parse a JsonValue::Object from an input string.
parse_string
Parse a JsonValue::String from an input string.