Crates.io | arya |
lib.rs | arya |
version | 0.0.3 |
source | src |
created_at | 2018-07-07 13:08:33.778641 |
updated_at | 2018-09-26 23:53:14.639129 |
description | simple json validation. simple json repair. lightning fast. |
homepage | https://code.hinaria.com/p/arya |
repository | https://github.com/hinaria/arya |
max_upload_size | |
id | 73212 |
size | 51,743 |
simple json validation. simple json repair. lightning fast.
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
// => }
// => })
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