I want to get the "Data" list passed from my javascript to python FLASK APP and than work on the list "Data" JavaScript code to send is
function fetch()
{
var jsonObj={'email':"testuser4@test.tld",'Data': ['Name','Phone']};
$.ajax({
url:'http://192.168.56.102:5000/fetch',
data:jsonObj,
type:"POST",
dataType:"json",
crossDomain:true
}).done(function(result){console.log(result)}).fail(function(result){console.log("error")});
}
The Python FLASK code is
@app.route("/fetch", methods=["POST"])
def fetch():
print request.json
return jsonify({"Status":200})
from the print statement above I get
ImmutableMultiDict([('Data[]', u'Name'), ('Data[]', u'Phone'), ('email', u'testuser4@test.tld')])
But I want to get something like this
ImmutableMultiDict( { 'email': 'testuser4@test.tld', 'Data' : ['Name','Email'] } )
In short I want to get the list in server side so send by JSON.
PS : I have already tried How to get a JSON Object in Python (Flask Framework) but on implementing this I am getting
ImmutableMultiDict([])