Function dot_json::arr_to_dot_map [] [src]

pub fn arr_to_dot_map(src: &Vec<Value>) -> Map<String, Value>

Create a flat dot map from a deep Vec<serde_json::Value>

Example

use serde_json::{Map, Value, from_str};

let data = json!([
    "Lorem ipsum",
    [null, 123, true],
    { "qux": 789 }
]);

if let Value::Array(arr) = data {
    let dot_map = arr_to_dot_map(&arr);

    assert_eq!(Value::String("Lorem ipsum".to_string()), dot_map["0"]);
    assert_eq!(Value::Bool(true), dot_map["1.2"]);
}