Skip to main content

Crate zparse

Crate zparse 

Source
Expand description

zParse - High-performance JSON/TOML/YAML/XML parser

§Quick Start

use zparse::from_str;
let value = from_str(r#"{"name": "John", "age": 30}"#)?;
let name = value
    .as_object()
    .and_then(|obj| obj.get("name"))
    .and_then(|v| v.as_string())
    .unwrap_or_default();
assert_eq!(name, "John");

Re-exports§

pub use error::Error;
pub use error::ErrorKind;
pub use error::Pos;
pub use error::Result;
pub use error::Span;
pub use input::Input;
pub use lexer::Token;
pub use lexer::TokenKind;
pub use value::Array;
pub use value::Object;
pub use value::TomlDatetime;
pub use value::Value;
pub use convert::ConvertOptions;
pub use convert::Format;
pub use convert::convert;
pub use convert::convert_with_options;
pub use json::Config;
pub use json::Event;
pub use json::Parser;
pub use toml::Config as TomlConfig;
pub use toml::Parser as TomlParser;
pub use xml::Content as XmlContent;
pub use xml::Document as XmlDocument;
pub use xml::Element as XmlElement;
pub use xml::Parser as XmlParser;
pub use yaml::Config as YamlConfig;
pub use yaml::Parser as YamlParser;
pub use json::Config as JsonConfig;
pub use json::Parser as JsonParser;
pub use lexer::json::JsonLexer;
pub use lexer::yaml::YamlLexer;

Modules§

convert
Format conversion utilities
error
Error types for zparse
input
Input abstraction for different sources
json
JSON streaming parser module
lexer
Lexer module for tokenization
toml
TOML streaming parser module
value
DOM types for parsed JSON/TOML/YAML/XML values
xml
XML parser module
yaml
YAML streaming parser module

Functions§

detect_format_from_path
Detect input format from a file path extension (case-insensitive).
from_bytes
Parse JSON from bytes
from_str
Parse JSON from string
from_str_with_config
Parse with custom configuration
from_toml_bytes
Parse TOML from bytes
from_toml_str
Parse TOML from string
from_toml_str_with_config
Parse TOML with custom configuration
from_xml_bytes
Parse XML from bytes
from_xml_str
Parse XML from string
from_yaml_bytes
Parse YAML from bytes
from_yaml_str
Parse YAML from string
from_yaml_str_with_config
Parse YAML with custom configuration