Python 如何在django中读取json数据?

Python 如何在django中读取json数据?,python,json,django,Python,Json,Django,如何从android表单(通过get方法)发送到django python服务器的JSON对象读取数据 我试过这个 def post_article(sample): #sample is the http request json = sample.read() data = json.loads(json) a = data['title'] response_data = {} response_data['title'] = a

如何从android表单(通过get方法)发送到django python服务器的JSON对象读取数据

我试过这个

def post_article(sample):      #sample is the http request   
    json = sample.read()
    data = json.loads(json) 
    a = data['title']
    response_data = {}
    response_data['title'] = a 
    return HttpResponse(json.dumps(response_data), content_type="application/json")

我只是返回请求的内容,因为它是为了检查我的工作状态。如果您使用相同的名称对
json
模块进行局部变量隐藏,请尝试使用不同的变量名称

def post_article(sample):      #sample is the http request   
    json_data = sample.read()
    data = json.loads(json_data) 
    a = data['title']
    response_data = {}
    response_data['title'] = a 
    return HttpResponse(json.dumps(response_data), content_type="application/json")

@ParitoshWalvekar我的意思更具体一些——错误页面或django日志中是否有回溯?