I'm trying to save a variable with double quotes in python, because I need to pass the double quoted JSON to a template and single quotes wont work with what I'm doing. So I set the variable in python to:
json = {
"auth": {
"key": "auth-code-here"
},
"template_id": "id-here",
"redirect_url": "url-here",
}
But immediate in python, it's saved as
{'redirect_url': 'url-here', 'template_id': 'id-here', 'auth': {'key': 'auth-code-here'}}
Is there a way I can save it as double quoted? Or will I need to process this in a django template to replace the single quotes for double quotes?
Thanks!
You should use a JSON module to do that. To Python, double- and single-quotes are interchangeable.
Python has JSON abilities built in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With