Debian Codegraph @

/

debian rust-json-event-parser 0.2.3+ds-1debian librust-json-event-parser-dev debian librust-json-event-parser-0.2+async-tokio-dev debian librust-json-event-parser-0.2+default-dev debian librust-json-event-parser-0.2-dev debian librust-json-event-parser-0.2.3-dev cargo json-event-parser 0.2.3 debianinimakefilemarkdownpythonrustrustrust-c-abishelltoml 28 files · 439 symbols
View dependency graph

Depends on

  • dh-rust (dh-sequence-rust)
  • debhelper-compat, librust-clap-dev, librust-tokio-dev
README (full)

JSON streaming parser and serializer

actions status Latest Version Released API docs

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 allowing to parse larger than memory files.

If you want fast and battle-tested code you might prefer to use json, serde_json or simd-json.

Parser example:

use json_event_parser::{ReaderJsonParser, JsonEvent};

let json = b"{\"foo\": 1}";
let mut reader = ReaderJsonParser::new(json.as_slice());
assert_eq!(reader.parse_next()?, JsonEvent::StartObject);
assert_eq!(reader.parse_next()?, JsonEvent::ObjectKey("foo".into()));
assert_eq!(reader.parse_next()?, JsonEvent::Number("1".into()));
assert_eq!(reader.parse_next()?, JsonEvent::EndObject);
assert_eq!(reader.parse_next()?, JsonEvent::Eof);
# std::io::Result::Ok(())

Serializer example:

use json_event_parser::{WriterJsonSerializer, JsonEvent};

let mut writer = WriterJsonSerializer::new(Vec::new());
writer.write_event(JsonEvent::StartObject) ?;
writer.write_event(JsonEvent::ObjectKey("foo".into())) ?;
writer.write_event(JsonEvent::Number("1".into())) ?;
writer.write_event(JsonEvent::EndObject) ?;

assert_eq!(writer.finish()?.as_slice(), b"{\"foo\":1}");
# std::io::Result::Ok(())

License

This project is licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or <http://www.apache.org/licenses/LICENSE-2.0>)
  • MIT license (LICENSE-MIT or <http://opensource.org/licenses/MIT>)

at your option.

Contribution

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.

dir JSONTestSuite/
dir benches/
dir debian/
dir fuzz/
dir src/
dir tests/
file CHANGELOG.md
file Cargo.toml
file LICENSE-APACHE
file LICENSE-MIT
file README.md
file deny.toml
file typos.toml