tiny-json-rs
A minimalistic Rust library for encoding and decoding JSON, offering a lower memory footprint alternative to serde.
Introduction
tiny-json-rs
is an open-source library designed for efficiently handling JSON in Rust applications. It aims to provide functionality similar to the serde library but focuses on reducing memory usage, making it an ideal choice for resource-constrained environments or applications where performance is critical.
Features
- Efficient JSON Encoding/Decoding: Optimized for lower memory usage.
- Easy Integration: Simple API, compatible with standard Rust structs.
- Customizable: Extendable to support various data types.
Usage
Add tiny-json-rs
to your Cargo.toml:
[]
= "0.1.0"
Basic Examples
Struct Definition
Define your structs and derive Deserialize
and Serialize
:
use ;
Deserializing JSON
Convert a JSON string to a Rust struct:
let json = r#"{"a": 1, "b": "Hello"}"#;
let parsed: A = decode.unwrap;
assert_eq!;
assert_eq!;
Serializing to JSON
Convert a Rust struct to a JSON string:
let obj = A ;
let json = encode;
assert_eq!;
Testing
tiny-json-rs
comes with a suite of tests to ensure functionality:
Contributing
Contributions to tiny-json-rs
are welcome! Please refer to the CONTRIBUTING.md for guidelines on how to contribute.
License
tiny-json-rs
is licensed under MIT.