Skip to main content

json_cast

Function json_cast 

Source
pub fn json_cast<N, M>(params: N) -> Result<M, Error>
Expand description

Cast from N to M by serializing/deserialization to/from JSON.

Failures are Parse errors (-32700). Don’t use this for the params of an incoming request or notification: a peer that sends malformed params must get Invalid params (-32602), which json_cast_params returns. Use json_cast for values the SDK or your own code produced, such as response results.

Returned diagnostics can contain the input JSON and payload-bearing parse reasons. Treat them as sensitive, as with json_cast_params.