Skip to main content

to_json

Function to_json 

Source
pub fn to_json(envelope: &ValueEnvelope) -> Value
Expand description

Convert an envelope to JSON (for debugging/external tools)

JSON is less efficient than MessagePack but more portable and human-readable.

ยงExample

use shape_wire::{to_json, ValueEnvelope};

let env = ValueEnvelope::string("hello");
let json = to_json(&env);
assert!(json["value"]["String"].is_string());