MCPcopy Create free account
hub / github.com/aeroxy/chrome-devtools-cli / format_structured

Function format_structured

src/format.rs:39–48  ·  view source on GitHub ↗

Encode a serde_json::Value as TOON or pretty-printed JSON.

(value: &Value, format: OutputFormat)

Source from the content-addressed store, hash-verified

37
38/// Encode a serde_json::Value as TOON or pretty-printed JSON.
39pub fn format_structured(value: &Value, format: OutputFormat) -> Result<String> {
40 match format {
41 OutputFormat::Json => Ok(serde_json::to_string_pretty(value)?),
42 OutputFormat::Toon => {
43 let options = toon_format::EncodeOptions::default();
44 Ok(toon_format::encode(value, &options)?)
45 }
46 OutputFormat::Text => Ok(serde_json::to_string_pretty(value)?),
47 }
48}
49
50#[cfg(test)]
51mod tests {

Callers 14

format_console_outputFunction · 0.85
format_outputFunction · 0.85
take_snapshotFunction · 0.85
list_pagesFunction · 0.85
take_heapsnapshotFunction · 0.85
format_node_detailsFunction · 0.85
format_network_outputFunction · 0.85
collect_sw_logsFunction · 0.85
list_3p_toolsFunction · 0.85

Calls

no outgoing calls