Crate arya[−][src]
arya.
simple json validation. simple json repair. lightning fast.
usage.
arya contains two main classes:
JsonBuilder
- a string builder for json that can repair and complete incomplete ("damaged") json.JsonVerifier
- a fast json syntax validator.
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
Structs
JsonBuilder |
a string builder for json that can repair and complete incomplete ("damaged") json. |
JsonVerifier |
a fast json syntax validator for utf8 sequences. |
Enums
JsonError |
the error type for arya json errors. |
JsonStatus |
describes json parse status. |
Traits
JsonSource |
utf8 byte streams for arya's json parsers. |