diff

Function diff 

Source
pub fn diff(old: &Value, new: &Value) -> Option<Value>
Expand description

provides a new Value containing the differences between the old and new.

If the old Value was Value::Null then the new Value is returned BUT with the null and empty values stripped as they have not been changed compared to the old as there was no old and so no difference.

use json_plus::diff;
use serde_json::json;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let old = json!({"key":"old value", "arr":[]});
    let new = json!({"key":"new value", "arr":[]});

    let diffed = diff(&old, &new).unwrap();
    println!("{}", diffed.to_string());
    Ok(())
}