When sending POST data containing values ββthat are arrays or objects, jQuery follows the PHP convention of adding parentheses to field names . This is not a web standard, but because PHP supports it out of the box, it is popular.
As a result, the correct way to process POST data with lists on the Flask side is really to add square brackets to the field names, as you discovered. You can get all list values ββusing MultiDict.getlist() :
request.form.getlist("x[]")
( request.form is a MultiDict object). This returns strings, not numbers. If you know the values ββfor numbers, you can tell getlist() to convert them for you:
request.form.getlist("x[]", type=float)
If you do not want to use extra brackets, do not use arrays as values ββor encode your data in JSON instead. You will have to use jQuery.ajax() , though:
$.ajax({ url: "/test", type: "POST", data: JSON.stringify({x: [1.0,2.0,3.0], y: [2.0, 3.0, 1.0]}), contentType: "application/json; charset=utf-8", success: function(dat) { console.log(dat); } });
and on the server side, use request.get_json() to analyze the published data:
data = request.get_json() x = data['x']
It also allows you to handle data type conversions; you sent the floating point numbers as JSON, and Flask decrypts them again again for the float values ββon the Python side.