6 releases (3 major breaking)
Uses new Rust 2024
3.1.0 | Mar 31, 2025 |
---|---|
3.0.0 | Mar 11, 2025 |
2.0.1 | Mar 11, 2025 |
1.0.0 | Mar 10, 2025 |
0.1.0-alpha.1 | Mar 10, 2025 |
#2501 in Encoding
420 downloads per month
52KB
968 lines
shapely-json
A serialization and deserialization library for JSON using the shapely runtime reflection system.
Features
- Simple JSON deserialization for any type implementing the
Shapely
trait - Detailed error reporting with context
- Support for nested structs and scalar values
Example
use shapely::Shapely;
use shapely_json::from_json;
#[derive(Debug, Shapely, PartialEq)]
struct Person {
name: String,
age: u64,
}
let json = r#"{"name": "Alice", "age": 30}"#;
let mut partial = Person::partial();
from_json(&mut partial, json).expect("Failed to parse JSON");
let person = partial.build::<Person>();
assert_eq!(person, Person { name: "Alice".to_string(), age: 30 });
Funding
Thanks to Namespace for providing fast GitHub Actions workers:
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Dependencies
~395KB