Skip to content

Latest commit

 

History

History
39 lines (33 loc) · 907 Bytes

README.md

File metadata and controls

39 lines (33 loc) · 907 Bytes

jsonpointer_flatten

crates.io docs.rs

Rust library to flatten a JSON object using JSON Pointer field addressing as defined in IETF RFC 6901.

Usage

let value = json!(
    {
        "name": "John Smith",
        "age": 24,
        "address": {
            "country": "US",
            "zip": "00000"
        },
        "phones": [ "123", "456" ]
    }
);

let actual = jsonpointer_flatten::from_json(&value);

Outputs

{
  "": {},
  "/address": {},
  "/address/country": "US",
  "/address/zip": "00000",
  "/age": 24,
  "/name": "John Smith",
  "/phones": [],
  "/phones/0": "123",
  "/phones/1": "456"
}