use super::super::{FmtError, Format};
use serde::de::DeserializeOwned;
pub struct Json;
impl Format for Json {
fn extensions(&self) -> &'static [&'static str] {
&["json"]
}
fn parse<T: DeserializeOwned>(&self, input: &[u8]) -> Result<T, FmtError> {
serde_json::from_slice(input).map_err(|e| FmtError::ParseError(e.to_string()))
}
}