SerialZero
A minimalist JSON parsing and serialization library for Rust.
Features
- Zero dependencies: No external libraries, keeping your project lean.
- Optimized for speed: Written with performance in mind, for both parsing and serializing JSON.
- Minimal API: Simple, clean API that's easy to use without boilerplate.
- Customizable: Allows customization for use cases like date formatting or naming conventions (camelCase, snake_case).
- Portable: Ideal for projects with strict size limitations (embedded systems, webassembly, etc.).
Installation
Add SerialZero to your Cargo.toml:
[]
= "0.1.0"
Quick Start
use ;
Working with JSON Values
SerialZero makes it easy to create, access, and modify JSON data:
use ;
use HashMap;
// Create JSON values
let null = Null;
let bool_value = Boolean;
let number = Number;
let string = String;
let array = Array;
// Build an object
let mut obj = new;
obj.insert;
obj.insert;
let object = Object;
// Or use the convenient macro
let user = json!;
// Access data with the extension trait
if let Some = user.get.and_then
// Navigate nested structures
if let Some = user.get.and_then
Customization Options
SerialZero provides customization options for serialization:
use ;
let options = SerializeOptions ;
let json = to_string_with_options;
Error Handling
SerialZero provides detailed error information:
use ;
match parse
Why SerialZero?
SerialZero aims to fill the niche between full-featured libraries like serde_json and minimalist parsers. It offers:
- Zero dependencies for leaner projects
- Simplified API for common JSON operations
- Fast parsing and serialization with minimal overhead
- Format customization (camelCase/snake_case, pretty-printing)
- Helper functions and traits for ergonomic JSON manipulation
Performance Considerations
SerialZero is designed with performance in mind, but it prioritizes a clean API and zero dependencies over absolute maximum performance. For extremely performance-critical applications where you need the fastest possible JSON handling, consider benchmarking against alternatives.