lambda_router/runtime/json.rs
1//! # json
2//! a re-export of serde_json with error wrapping and only operates on Result<T, E> where T & E impl Serialize
3
4use serde::Serialize;
5
6use super::error::Error;
7
8/// a simple re-export wrapper of serde_json::to_string for Result<T, E>
9pub fn json<T: Serialize, E: Serialize>(result: &Result<T, E>) -> Result<String, Error> {
10 Ok(serde_json::to_string(result)?)
11}