Skip to content

Instantly share code, notes, and snippets.

@MeLight
Created June 1, 2015 11:39
Show Gist options
  • Save MeLight/5e11d88657f8619807ee to your computer and use it in GitHub Desktop.
Save MeLight/5e11d88657f8619807ee to your computer and use it in GitHub Desktop.
//-------- Client side
var my_array = ['a', 'b', 'c'];
$.get('/api/end_point', {arr: JSON.stringify(my_array)}, function(data) { //note that we stringify the array before sending it
//we assume everything went well on the server
}, 'json');
#--------- Server side
import json
class ArrayRequestHandler(webapp2.RequestHandler):
def get(self):
python_list = json.loads(self.request.get('arr')) #we rebuild the JSON from the string received
single_var = python_list[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment