deep-diff

Crates.iodeep-diff
lib.rsdeep-diff
version0.1.1
created_at2025-09-06 12:23:19.241726+00
updated_at2025-09-06 12:30:48.759533+00
descriptionA small crate to deeply diff serde_json::Value trees.
homepage
repositoryhttps://github.com/thePaulBurger/deep-diff
max_upload_size
id1827013
size12,449
(thePaulBurger)

documentation

https://docs.rs/deep-diff

README

deep-diff

A small Rust crate to deeply diff serde_json::Value trees.

This crate helps you compare two JSON values recursively and returns a list of differences, showing exactly which parts have changed.

Features

  • Compare JSON objects, arrays, strings, numbers, booleans, and nulls
  • Reports differences with precise JSON path notation
  • Lightweight and easy to integrate

Usage

Add this to your Cargo.toml:

[dependencies]
deep-diff = "0.1"
serde_json = "1.0"

Example

use deep_diff::{deep_diff, Difference};
use serde_json::json;

fn main() {
    let a = json!({"name": "Alice", "age": 30});
    let b = json!({"name": "Bob", "age": 30});

    let diffs = deep_diff(&a, &b);

    for diff in diffs {
        println!("Changed at path '{}': from {:?} to {:?}", diff.path, diff.before, diff.after);
    }
}
Commit count: 4

cargo fmt