A user needs to pass a json object as a part of the request. It would look something like this:
{"token" :"ayaljltja",
"addresses": [
{'name':'Home','address':'20 Main Street',
'city':'new-york'},
{'name':'work', 'address':'x Street', 'city':'ohio'}
]}
I have two problems right now. First, I can't figure out how to test this code by recreating the nested POST. I can successfully POST a dict but posting the list of addresses within the JSON object is messing me up.
Simply using cURL, how might I do this? How might I do it with urrlib2?
My second issue is then deserializing the JSON POST object on the server side. I guess I just need to see a successful POST to determine the input (and then deserialize it with the json module).
Any tips?
First make sure your JSON is valid. Paste it into the JSONLint web page.
Currently your JSON has two issues:
"token" :"ayaljltja"
and "addresses": [...]
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