arya

Crates.ioarya
lib.rsarya
version0.0.3
sourcesrc
created_at2018-07-07 13:08:33.778641
updated_at2018-09-26 23:53:14.639129
descriptionsimple json validation. simple json repair. lightning fast.
homepagehttps://code.hinaria.com/p/arya
repositoryhttps://github.com/hinaria/arya
max_upload_size
id73212
size51,743
annie (hinaria)

documentation

https://docs.hinaria.com/p/arya

README

arya.

simple json validation. simple json repair. lightning fast.

example: json validation + repair.

let mut builder = JsonBuilder::new();

builder.update(r#"{
    "name": "annie",
    "age": 14,
    "parents": {
        "mother": null,
        "broken
"#);

builder.update("value");

builder.completed_string()

// => Ok({
// =>     "name": "annie",
// =>     "age": 14,
// =>     "nested": {
// =>         "mother": null
// =>     }
// => })

example: json validation

let mut json = JsonVerifier::new();

for character in r#"{ "name": "annie", "value": 1 }"#.bytes() {
    println!(
        "{} - {:?} - {:?}",
        character as char,
        json.update(character),
        json.status());
}

//     { - Ok(()) - Continue
//       - Ok(()) - Continue
//     " - Ok(()) - Continue
//     n - Ok(()) - Continue
//     a - Ok(()) - Continue
//     m - Ok(()) - Continue
//     e - Ok(()) - Continue
//     " - Ok(()) - Continue
//     : - Ok(()) - Continue
//       - Ok(()) - Continue
//     " - Ok(()) - Continue
//     a - Ok(()) - Continue
//     n - Ok(()) - Continue
//     n - Ok(()) - Continue
//     i - Ok(()) - Continue
//     e - Ok(()) - Continue
//     " - Ok(()) - Continue
//     , - Ok(()) - Continue
//       - Ok(()) - Continue
//     " - Ok(()) - Continue
//     v - Ok(()) - Continue
//     a - Ok(()) - Continue
//     l - Ok(()) - Continue
//     u - Ok(()) - Continue
//     e - Ok(()) - Continue
//     " - Ok(()) - Continue
//     : - Ok(()) - Continue
//       - Ok(()) - Continue
//     1 - Ok(()) - Continue
//       - Ok(()) - Continue
//     } - Ok(()) - Valid
Commit count: 8

cargo fmt