I'm experiencing some difficulties when parsing a JSON object sent from AngularJS to Python (Google App Engine).
The AngularJS code:
var article = { name: 'car' };
$http.put("articles", article);
The python code:
# -*- coding: UTF-8 -*-
import os
import webapp2
import logging
import json
class ArticleHandler(webapp2.RequestHandler):
def put(self):
data = self.request
logging.error(data)
#x = json.dumps(data)
#y = json.loads(data)
The error-log returns {"name":"car"}
json.dumps(data) raises: TypeError(repr(o) + " is not JSON serializable")
and
json.loads(data) raises: TypeError: expected string or buffer
Any help is appreciated