{'coolstring': {'stepone': {'X': '44', 'Y': '66'}}}
If your input is a dictionary, there's a json
module which does exactly what you need:
import json
dic = {'coolstring': {'stepone': {'X': '44', 'Y': '66'}}}
json_string = json.dumps(dic)
print(json_string)
The output will be:
{"coolstring": {"stepone": {"X": "44", "Y": "66"}}}
However if your data is a string, you can use the proposed solution from the other comment by using replace()