rdftk_io/json/mod.rs
1/*!
2Provides for writing a `Graph` instance in the
3W3C [RDF 1.1 JSON Alternate Serialization (RDF/JSON)](https://www.w3.org/TR/rdf-json/) format.
4
5# Example Writer
6
7```rust
8use rdftk_io::json::{JsonWriter, JsonOptions};
9# use objio::{HasOptions, ObjectWriter};
10# use rdftk_core::model::graph::Graph;
11# fn make_graph() -> Graph { Graph::default() }
12
13let writer = JsonWriter::default()
14 .with_options(JsonOptions::default().with_pretty_print(true));
15
16let result = writer.write_to_string(&make_graph());
17```
18
19 */
20
21// ------------------------------------------------------------------------------------------------
22// Public Values
23// ------------------------------------------------------------------------------------------------
24
25/// The display name of this serialization format.
26pub const NAME: &str = "JSON";
27
28/// The common file extension for this serialization format.
29pub const FILE_EXTENSION: &str = "json";
30
31/// The MIME type used for this serialization format.
32pub const MIME_TYPE: &str = "application/rdf+json";
33
34// ------------------------------------------------------------------------------------------------
35// Modules
36// ------------------------------------------------------------------------------------------------
37
38mod syntax;
39
40mod reader;
41pub use reader::JsonReader;
42
43mod writer;
44pub use writer::{JsonOptions, JsonWriter};