carta_readers/json.rs
1//! JSON interchange reader: a thin [`Reader`] adapter over the AST's own serde codec.
2
3use carta_ast::Document;
4use carta_core::{Reader, ReaderOptions, Result};
5
6/// Parses an interchange JSON document into the document model.
7#[derive(Debug, Default, Clone, Copy)]
8pub struct JsonReader;
9
10impl Reader for JsonReader {
11 fn read(&self, input: &str, _options: &ReaderOptions) -> Result<Document> {
12 Ok(carta_ast::from_json(input.as_bytes())?)
13 }
14}