Docs.rs
  • json-syntax-0.12.5
    • json-syntax 0.12.5
    • Permalink
    • Docs.rs crate page
    • MIT/Apache-2.0
    • Links
    • Repository
    • crates.io
    • Source
    • Owners
    • timothee-haudebourg
    • Dependencies
      • contextual ^0.1.1 normal optional
      • decoded-char ^0.1 normal
      • hashbrown ^0.12.1 normal
      • indexmap ^1.9.1 normal
      • json-number ^0.4.8 normal
      • locspan ^0.8.2 normal
      • locspan-derive ^0.6 normal
      • ryu-js ^0.2.2 normal optional
      • serde ^1.0 normal optional
      • serde_json ^1.0 normal optional
      • smallstr ^0.3 normal
      • smallvec ^1.9 normal
      • utf8-decode ^1.0.1 normal
      • serde ^1.0 dev
    • Versions
    • 38.15% of the crate is documented
  • Platform
    • i686-pc-windows-msvc
    • i686-unknown-linux-gnu
    • x86_64-apple-darwin
    • x86_64-pc-windows-msvc
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate json_syntax

json_syntax0.12.5

  • All Items

Sections

  • Features
  • Usage

Crate Items

  • Re-exports
  • Modules
  • Macros
  • Structs
  • Enums
  • Constants
  • Traits
  • Functions
  • Type Aliases

Crates

  • json_syntax

Crate json_syntax

Source
Expand description

This library provides a strict JSON parser as defined by RFC 8259 and ECMA-404. Parsing values generates a CodeMap that keeps track of the position of each JSON value fragment in the parsed document.

§Features

  • Strict implementation of RFC 8259 and ECMA-404.
  • No stack overflow, your memory is the limit.
  • Numbers are stored in lexical form thanks to the json-number crate, their precision is not limited.
  • Duplicate values are preserved. A JSON object is just a list of entries, in the order of definition.
  • Strings are stored on the stack whenever possible, thanks to the smallstr crate.
  • The parser is configurable to accept documents that do not strictly adhere to the standard.
  • Highly configurable printing methods.
  • Macro to build any value statically.
  • JSON Canonicalization Scheme implementation (RFC 8785) enabled with the canonicalization feature.
  • serde support (by enabling the serde feature).
  • Conversion from/to serde_json::Value (by enabling the serde_json feature).
  • Thoroughly tested.

§Usage

use std::fs;
use json_syntax::{Value, Parse, Print};

let filename = "tests/inputs/y_structure_500_nested_arrays.json";
let input = fs::read_to_string(filename).unwrap();
let mut value = Value::parse_str(&input).expect("parse error").0;
println!("value: {}", value.pretty_print());

Re-exports§

pub use code_map::CodeMap;
pub use parse::Parse;
pub use print::Print;
pub use kind::Kind;
pub use kind::KindSet;
pub use array::Array;
pub use object::Object;

Modules§

array
code_map
kind
JSON value kinds.
number
object
parse
print

Macros§

json
Constructs a json_syntax::Value from a JSON literal.

Structs§

InvalidNumber
Invalid number error.
KeySerializer
Number
Lexical JSON number.
NumberType
SerializeArray
SerializeStructVariant
SerializeTupleVariant
Serializer
Value serializer.
StringNumberSerializer
Traverse
Unexpected
Unexpected JSON value kind error.
Unordered
Wrapper to view a value without considering the order of the objects entries.

Enums§

DeserializeError
FragmentRef
SerializeError
SerializeMap
SubFragments
TryIntoNumberError
Value
JSON Value.

Constants§

NUMBER_CAPACITY
Number buffer stack capacity.
SMALL_STRING_CAPACITY
String stack capacity.

Traits§

BorrowUnordered
TryFromJson
Conversion from JSON syntax, with code mapping info.
TryFromJsonObject
Conversion from JSON syntax object, with code mapping info.
UnorderedEq
UnorderedHash
UnorderedPartialEq

Functions§

from_value
Deserializes the JSON value into an instance of type T.
get_array_fragment
to_value
Serializes the given value into a JSON Value.

Type Aliases§

NumberBuf
Number buffer.
String
String.

Results

Settings
Help
    trait
    json_syntax::print::Print
    Print methods.
    module
    json_syntax::print
    struct
    json_syntax::print::Printed
    Printed value.
    method
    json_syntax::print::Print::print_with
    Print the value with the given options.
    function
    json_syntax::print::print_array
    function
    json_syntax::print::print_object
    trait
    json_syntax::print::PrintWithSize
    trait
    json_syntax::print::PrintWithContext
    function
    json_syntax::print::printed_string_size
    Returns the byte length of string literal according to …
    trait
    json_syntax::print::PrintWithSizeAndContext
    method
    json_syntax::print::Print::inline_print
    Print the value with Options::inline options.
    method
    json_syntax::print::Print::pretty_print
    Print the value with Options::pretty options.
    method
    json_syntax::print::Print::compact_print
    Print the value with Options::compact options.
    method
    json_syntax::print::Print::inline_print
    &Print -> Printed<Print>
    Print the value with Options::inline options.
    method
    json_syntax::print::Print::pretty_print
    &Print -> Printed<Print>
    Print the value with Options::pretty options.
    method
    json_syntax::print::Print::compact_print
    &Print -> Printed<Print>
    Print the value with Options::compact options.
    method
    json_syntax::print::Print::print_with
    &Print, Options -> Printed<Print>
    Print the value with the given options.
    trait method
    json_syntax::print::Print::fmt_with
    &Print, &mut Formatter, &Options, usize -> Result
No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.