JSON event parser is a simple streaming JSON parser and serializer implementation in Rust.
It does not aims to be the fastest JSON parser possible but to be a simple implementation.
If you want fast and battle-tested code you might prefer to use json, serde_json or simd-json.
Reader example:
```rust use jsoneventparser::{FromReadJsonReader, JsonEvent};
let json = b"{\"foo\": 1}"; let mut reader = FromReadJsonReader::new(json.asslice()); asserteq!(reader.readnextevent()?, JsonEvent::StartObject); asserteq!(reader.readnextevent()?, JsonEvent::ObjectKey("foo".into())); asserteq!(reader.readnextevent()?, JsonEvent::Number("1".into())); asserteq!(reader.readnextevent()?, JsonEvent::EndObject); asserteq!(reader.readnextevent()?, JsonEvent::Eof);
```
Writer example:
```rust use jsoneventparser::{ToWriteJsonWriter, JsonEvent};
let mut writer = ToWriteJsonWriter::new(Vec::new()); writer.writeevent(JsonEvent::StartObject)?; writer.writeevent(JsonEvent::ObjectKey("foo".into()))?; writer.writeevent(JsonEvent::Number("1".into()))?; writer.writeevent(JsonEvent::EndObject)?;
asserteq!(writer.finish()?.asslice(), b"{\"foo\":1}");
```
This project is licensed under either of
<http://www.apache.org/licenses/LICENSE-2.0>
)<http://opensource.org/licenses/MIT>
)at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in json-event-parser by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.