I built a webserver in Flask and I'm passing in the request using jsonp. One of the things I pass in is an nested array and when I retrieve the data in Flask, the array is completely messed up. Here's my code
index.html
var array = [[2,1],[2,2],[2,3]]
function getNext() {
var data = {
'M': 5,
'N': 5,
'array' : array
};
$.ajax({
url: '/getNewGeneration',
jsonp: 'callback',
dataType: 'jsonp',
data: data,
success: function(response) {
...
}
});
}
server.py
@app.route('/getNewGeneration')
def getNext():
M = request.args.get('M')
N = request.args.get('N')
liveCells = request.args.get('liveCells')
...
When I print out request.args I get ImmutableMultiDict([('callback', u'jQuery17101683842277548142_1412736365518'), ('array[2][]', u'2'), ('array[2][]', u'3'), ('array[1][]', u'2'), ('array[1][]', u'2'), ('N', u'5'), ('M', u'5'), ('_', u'1412736417145'), ('array[0][]', u'2'), ('array[0][]', u'1')])
Does anyone know how to fix this?
request.jsonalso that messed up?