Skip to main content

json_escape

Function json_escape 

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

Escape a Rust string for inclusion in a JSON string literal. Sufficient for the small, known fields emitted by --format=json callers (commit messages, hashes, identity strings). Does NOT handle surrogate pairs — UTF-8 round-trips as itself since JSON strings are UTF-8.