jsonvalueremove

Actions Status semantic-release

Give an interface to remove element into a json_serde::Value.

Installation

Toml [dependencies] json_value_remove = "1.0"

Usage

Remove in an array:

```rust extern crate jsonvalueremove;

use jsonvalueremove::Remove; use serde_json::Value;

{ let mut array1: Value = serdejson::fromstr(r#"{"mytable":["a","b","c"]}"#).unwrap(); asserteq!(Some(Value::String("a".tostring())), array1.remove("/mytable/0").unwrap()); asserteq!(r#"{"mytable":["b","c"]}"#, array1.to_string()); } ```

Remove in an objects:

```rust extern crate jsonvalueremove;

use jsonvalueremove::Remove; use serde_json::Value;

{ let mut object1: Value = serdejson::fromstr(r#"{"field1.0":{"field1.1":"value1.1","field1.2":"value1.2"},"field2.0":"value2.0"}"#).unwrap(); asserteq!(Some(Value::String("value1.2".tostring())), object1.remove("/field1.0/field1.2").unwrap()); asserteq!(r#"{"field1.0":{"field1.1":"value1.1"},"field2.0":"value2.0"}"#,object1.tostring()); } ```

Useful link

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

Apache MIT