deep-diff 0.1.1

A small crate to deeply diff serde_json::Value trees.
Documentation
  • Coverage
  • 83.33%
    5 out of 6 items documented1 out of 3 items with examples
  • Size
  • Source code size: 11.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.63 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 24s Average build duration of successful builds.
  • all releases: 26s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • thePaulBurger/deep-diff
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • thePaulBurger

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);
    }
}