Skip to main content

escape_json

Function escape_json 

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

JSON-escape a string for inlining inside a JSON string literal, returning the contents WITHOUT the surrounding quotes. Mirrors Java’s OBJECT_MAPPER.writeValueAsString(value) then stripping the outer quotes.