#json-parser #json #parser

adventjson

A full json-parser written in Rust for the advent of code challenges

2 releases

0.1.1 May 28, 2021
0.1.0 Apr 14, 2021

#2948 in Parser implementations

GPL-3.0-or-later

36KB
942 lines

A simple JSON library

This is a simple JSON library I wrote for one of the advent of code challenges, but became a full, standard complaint JSON parser. To use it just call the JsonObject::read function with what you want to have parsed:

use adventjson::JsonObject;

let s = "{\"hello\": \"World\", \"answer\": 42}";
let json_object = JsonObject::read(s)?;

assert_eq!(format!("{}", json_object), s);

License

This library is distributed under the GPL license.


lib.rs:

A simple JSON library

This is a simple JSON library I wrote for one of the advent of code challenges, but became a full, standard complaint JSON parser. To use it just call the JsonObject::read function with what you want to have parsed:

 # use adventjson::JsonError;
 use adventjson::JsonObject;

 # fn main() -> Result<(), JsonError>
 # {
 let s = "{\"hello\": \"World\", \"answer\": 42}";
 let json_object = JsonObject::read(s)?;

 assert_eq!(format!("{}", json_object), s);
 # Ok(())
 # }

No runtime deps