jsonpointer_flatten

Crates.iojsonpointer_flatten
lib.rsjsonpointer_flatten
version0.1.3
sourcesrc
created_at2021-08-06 18:23:02.399518
updated_at2021-08-07 12:48:06.782786
descriptionLibrary to flatten a JSON object or array using JSON Pointer addressing
homepage
repositoryhttps://github.com/tmarkovski/jsonpointer_flatten/
max_upload_size
id432535
size9,206
Tomislav Markovski (tmarkovski)

documentation

README

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"
}
Commit count: 1

cargo fmt