json_ops 0.1.0

Implement json pointer following the json pointer syntax, with type Option<&toml::Value>. Overload / as path operator to point into a node in json tree, as well as some other meaningfull operator overload.
Documentation
// require enable the toml feature such as:
// cargo run --example pathwrite -F toml

use json_ops::ValuePath;

fn main()
{
    let str_toml = include_str!("./sample.toml");
    let mut v: toml::Value = str_toml.parse().unwrap();

    println!("original toml content:");
    println!("{str_toml}");

    println!("modify by path:");

    let node = v.path_mut() / "ip";
    let _ = node << "127.0.0.2";

    // push key-val pair to table
    let mut node = v.path_mut() / "host";
    node = node << ("newkey1", 1) << ("newkey2", "2");

    // push scalar to leaf node, replace it
    let _ = node / "port" << 8888;

    // push single tuple to array
    node = v.path_mut() / "host" /"protocol";
    let _ = node << (8989,) << ("xyz",);

    // <<= can change node type while << cannot
    let _ = v.path_mut() / "misc" / "bool" << "false";

    println!("{}", v);
}