Skip to main content

as_json

Function as_json 

Source
pub fn as_json<T: Serialize, S: Serializer>(
    value: &T,
    serializer: S,
) -> Result<S::Ok, S::Error>
Expand description

serialize_with helper that sends a list as a JSON array string instead of a comma-separated list. Used by arguments whose documented example looks like ["C1","C2"].

ยงErrors

Fails when value cannot be serialized to JSON (for example, a map with non-string keys).