gotham-serde-json-body-parser

JSON body parser for the Gotham web framework.

Crates.io

This is a simple integration of serde_json crate to eliminate the boilerplate code of parsing a request body. If parsing fails, a HTTP 422 (Unprocessable entity) is returned. This crate also provides a convenience function to create JSON responses.

```rust use gothamserdejsonbodyparser::{createjsonresponse, JSONBody};

[derive(Debug, Deserialize, Serialize)]

struct Person { name: String, }

pub fn jsonecho(state: State) -> Box { Box::new(state.json::().andthen(|(state, person)| { let res = createjsonresponse(&state, StatusCode::Ok, &person).unwrap(); Ok((state, res)) })) } ```