pub fn safely_parse_json(s: &str) -> Result<Value, Error>Expand description
Safely parse a JSON string that may contain doubly-encoded or malformed JSON. This function first attempts to parse the input string as-is. If that fails, it applies control character escaping and tries again.
This approach preserves valid JSON like {"key1": "value1",\n"key2": "value"}
(which contains a literal \n but is perfectly valid JSON) while still fixing
broken JSON like {"key1": "value1\n","key2": "value"} (which contains an
unescaped newline character).