Skip to main content

json

Function json 

Source
pub fn json<T>(val: T) -> ReplyData
where T: Serialize,
Expand description

Build a JSON ReplyData from any Serialize value.

Panics on serialization failure. Most domain types (those with derived Serialize over stringy fields) never fail, but custom impls can. The reply! macro uses try_json internally to convert that case into a WebError::Internal (→ 500) rather than a handler-level panic that would drop the whole connection.

Prefer reply!(my_value) over calling this directly.