So I was trying to use OrderedDict inside json.dumps() and it started off working well. However, when trying to use the output directly inside a payload of an HTTP PUT request, it has these single quotes around it that I believe is screwing with the way the json is being interpreted at the receiving end.
So how do I get around this and have it give me the output without the single quotes?
Example:
out = json.dumps(OrderedDict([("name", 1), ("value", 2)]))
... gives an output such as:
'{"name": 1, "value": 2}'
... when I want it to give me the meat, the json, like:
{"name": 1, "value": 2}
... so that I can put that straight into my
r = requests.post(url, data = out)
... and be on my merry way.
As an aside: is there something VERY basic about strings and string literals (whatever those are) that I am completely missing? My Python knowledge being self taught I am sure there are some gaps.
EDIT:
print(out)
... gives
{"name": 1, "value": 2}
which is what I believe I want.
EDIT2: json = out
as mentioned in the selected answer did the trick thank you! However, since I am just starting out with coding in Python, I would love to know whether you have come across any articles/ documentation that might be handy for me to know so as to avoid similar issues in the future. Thanks once again everyone!