rs-data-json 0.1.0
JSON made easy: serialize, pretty print, read and write files, look values up by path, merge documents
Install
cargo add rs-data-json --registry rupm
In Ruststudio: Packages, search for rs-data-json, Install.
Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.
Versions
- 0.1.0 2026-11-23
README
# rs-data-json
JSON made easy: serialize, pretty print, read and write files, look values up by path, merge documents
Add it with `rupm add rs-data-json` (or `cargo add rs-data-json --registry rupm`).
```rust
use rs_data_json::{get, json, read_file, to_pretty, write_file, Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
#[serde(crate = "rs_data_json::serde")]
struct Settings { name: String, port: u16 }
fn main() -> Result<(), rs_data_json::Error> {
let s = Settings { name: "demo".into(), port: 8080 };
println!("{}", to_pretty(&s)?);
write_file("settings.json", &s)?;
let back: Settings = read_file("settings.json")?;
println!("{back:?}");
let doc = json!({ "user": { "tags": ["a", "b"] } });
println!("{:?}", get(&doc, "user.tags[1]")); // Some("b")
Ok(())
}
```