When we send a JSON body containing a serialized JSON object as a property value, format_object() causes two issues.
Sample json:
{
"inputs": [
{
"data": "{\"features\": [{\"geometry\": {\"type\": \"Polygon\", \"coordinates\": []}}]}"
}
]
First issue is related to .replace('{{', '{').replace('}}', '}') that replaced the "}}" with "}", which errors the parsing.
Second issue is the parsing that will be chosen in this case will be the one defined by isinstance(o, str) since it's a string, therefore not parsing the body properly, and will try to replace parts of the string with non-existing environment variables.