Skip to main content

struct_to_json

Function struct_to_json 

Source
pub fn struct_to_json(s: &Struct) -> Value
Expand description

Converts a protobuf Struct to a JSON value.

The conversion is total: a number that JSON cannot represent (NaN or infinity) becomes null. Struct numbers are f64, so integers above 2^53 have already lost precision on the wire. Integral numbers are emitted as JSON integers (see pb_to_json), so the result deserializes cleanly into typed structs with integer fields.