Crates.io | sjdiff |
lib.rs | sjdiff |
version | 0.0.7 |
source | src |
created_at | 2024-11-23 11:47:13.87989 |
updated_at | 2024-12-03 14:37:10.542594 |
description | Structural JSON Diff Library for Rust |
homepage | |
repository | https://github.com/amanbolat/sjdiff |
max_upload_size | |
id | 1458396 |
size | 59,630 |
sjdiff
– is a library for Rust that compares two JSON values and produces a structural difference between them.
null == []
, 0.111 == 0.11
, 2023-07-25T15:30:01Z == 2023-07-25T15:30:00Z
.Compare two objects:
fn main() {
let obj1 = serde_json::json!({
"user": "John",
"age": 31
});
let obj2 = serde_json::json!({
"user": "John",
"age": 33
});
let diff = sjdiff::DiffBuilder::default()
.source(obj1)
.target(obj2)
.build()
.unwrap();
let diff = diff.compare();
serde_json::to_writer_pretty(std::io::stdout(), &diff).unwrap();
}
See more in the examples.
Thanks to teajey – author of serde_json_diff. I forked that project and implemented additional features that were essential for my workflow.
MIT