pub fn sanitize_json_string(input: &str) -> String
Expand description
Sanitize JSON string values to prevent JSON injection
This function escapes special characters in JSON string values to prevent injection attacks when building JSON dynamically.
ยงExample
use mockforge_core::validation::sanitize_json_string;
let input = r#"test","admin":true,"#;
let safe = sanitize_json_string(input);
assert!(safe.contains(r#"\""#));