Last night I was sending some data to my server via AJAX (specifically, $.post
), when I ran into the issue that JavaScript Arrays needed to be "stringified" and applied as a field to an object before being sent. That is:
$.post("/myUrl/", {"myKey": json.stringify(myArray)}, ... );
If I didn't perform the stringify
, the format of the POST would get screwed up by the time it reached Django.
Why do arrays need to be stringified for requests when objects can just be sent as is? Or, does this vary wildly on the back-end being used?