I want to write a function in Rust that can parse a JSON string and output a modified JSON with all the number fields converted to string. All other fields should be unchanged. Structure of the JSON string is not known in advance. Here's the desired function signature:
pub fn convert_all_numbers_to_string(json: &str) -> String
Examples:
Input:
{"foo": 18446744073709551615}
Output:
{"foo": "18446744073709551615"}
Input:
{
"some": [{
"deeply": {
"nested": [{
"path": 123
}]
}
}]
}
Output:
{
"some": [{
"deeply": {
"nested": [{
"path": "123"
}]
}
}]
}