Skip to main content

reply_with_json

Function reply_with_json 

Source
pub fn reply_with_json<T: Serialize>(
    json: &T,
) -> Result<impl Reply + use<T>, Rejection>
Expand description

Serialises json as a JSON body and returns it as a 200 OK reply result.

T must implement serde::Serialize. Equivalent to reply!(json => ...).