Skip to main content

escape_json

Function escape_json 

Source
pub fn escape_json(s: &str) -> String
Expand description

Escape a string for embedding in a JSON string literal. Complete per RFC 8259: backslash, quote, and every control char below 0x20. The hand-rolled predecessors missed \t / \r — one control character in a GPU name or mount path produced invalid JSON, which broke cluster probe fan-in.