zParse
Introduction
zParse is a high-performance Rust library and toolchain for parsing and converting JSON, TOML, YAML, and XML. It ships as a library, a CLI, and an HTTP API so you can integrate it in other Rust projects or expose it to a frontend.
Features
- Native parsers for JSON, TOML (with native datetime types), YAML 1.2, and XML
- Streaming/event-based parsing with depth and size limits
- Format conversion between all supported formats
- CLI for conversion with stdin/stdout support
- Axum API for programmatic access
Usage
Library
use ;
let json_value = from_str?;
let toml_value = from_toml_str?;
let yaml_value = from_yaml_str?;
let xml_doc = from_xml_str?;
# Ok::
Conversion
use ;
let out = convert?;
# Ok::
CLI
Top-level flags (--parse / --convert) mirror the subcommands and still accept --from / --to when you want to be explicit.
Root-level flags cannot be combined with subcommands.
By default, successful commands print ok. Use --print-output to write the input/converted content instead.
# Auto-detect format from file extension and validate
# Explicitly set the input format while using top-level flags
# Auto-detect format from file extension and echo on success
# Validate JSON input and print "ok" on success
# Validate TOML input and print "ok" on success
# Validate JSON and echo the original content on success
# Convert JSON to TOML and print "ok" on success
# Convert TOML to YAML with format inference for the input
# Auto-detect input format and convert to TOML
# Convert JSON to YAML and print the converted output on success
# Convert XML from stdin to JSON and write to stdout
|
# Convert JSON to TOML, write output to a file, and print "ok" to stdout
# Convert permissive JSON (comments + trailing commas) to YAML
Quick usage rules
- Use either a subcommand (
parse/convert) or a top-level flag (--parse/--convert), not both. --tois required for convert.--fromis optional when an input file path is provided (auto-detects by extension).- When reading from stdin, you must pass
--from.
API
Contribution
See CONTRIBUTING.md for guidelines and workflow details.
License
This project is licensed under the GPL-3.0 License.
Changelog
See CHANGELOG.md for version history and release notes.