get_schema_from_json_str

Function get_schema_from_json_str 

Source
pub fn get_schema_from_json_str(
    schema_json_string: &str,
) -> Result<HashMap<String, Column>, Error>
Expand description

Extracts a Result containing a JsonSchema CSV cleansing specification from a JSON string specification.

Example

use csv_log_cleaner::get_schema_from_json_str;

let schema_string = r#"{
"columns": [
    {
        "name": "NAME",
        "column_type": "String"
    },
    {
        "name": "AGE",
        "column_type": "Int"
    },
    {
        "name": "DATE_OF_BIRTH",
        "column_type": "Date",
        "format": "%Y-%m-%d"
    }
]
}"#;
let schema_map = get_schema_from_json_str(&schema_string).unwrap();
println!("{:?}", schema_map);