Docs.rs
  • json-syntax-0.9.0
    • json-syntax 0.9.0
    • Docs.rs crate page
    • MIT/Apache-2.0
    • Links
    • Repository
    • crates.io
    • Source
    • Owners
    • timothee-haudebourg
    • Dependencies
      • contextual ^0.1.1 normal
      • decoded-char ^0.1 normal
      • hashbrown ^0.12.1 normal
      • indexmap ^1.9.1 normal
      • json-number ^0.4.5 normal
      • locspan ^0.7.3 normal
      • locspan-derive ^0.6 normal
      • ryu-js ^0.2.2 normal
      • serde ^1.0 normal
      • serde_json ^1.0 normal
      • smallstr ^0.3 normal
      • smallvec ^1.9 normal
      • serde ^1.0 dev
    • Versions
    • 36.76% of the crate is documented
  • Go to latest version
  • 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
    • Badges
    • Builds
    • Metadata
    • Shorthand URLs
    • Download
    • Rustdoc JSON
    • Build queue
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation
logo

Crate json_syntax

logo

Crate json_syntax

  • Version 0.9.0
  • All Items
  • Re-exports
  • Modules
  • Macros
  • Structs
  • Enums
  • Constants
  • Traits
  • Type Definitions

Crates

  • json_syntax
?
Change settings

Crate json_syntax

source ·
Expand description

This library provides a strict JSON parser as defined by RFC 8259 and ECMA-404. It is built on the locspan library so as to keep track of the position of each JSON value 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, |span| span).expect("parse error");
println!("value: {}", value.pretty_print());

Re-exports

pub use parse::Parse;
pub use print::Print;
pub use object::Object;

Modules

object
parse
print

Macros

json
Constructs a Loc<json_syntax::Value, (), ()> from a JSON literal.

Structs

Number
Lexical JSON number.
Traverse
TraverseStripped
Unordered
Wrapper to view a value without considering the order of the objects entries.

Enums

FragmentRef
Kind
Value kind.
SerdeJsonFragment
A fragment of a serde_json::Value.
StrippedFragmentRef
SubFragments
Value
Value.

Constants

NUMBER_CAPACITY
Number buffer stack capacity.
SMALL_STRING_CAPACITY
String stack capacity.

Traits

BorrowUnordered
Traversal
UnorderedEq
UnorderedHash
UnorderedPartialEq

Type Definitions

Array
Array.
MetaValue
Value wrapped inside a locspan::Meta container.
NumberBuf
Number buffer.
String
String.

Results

json_syntax::UnorderedHash
json_syntax::UnorderedHash::unordered_hash
json_syntax::Unordered::hash
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.