Python 使用rest控制台django无法从post请求中获取正确的json

Python 使用rest控制台django无法从post请求中获取正确的json,python,json,django,rest,Python,Json,Django,Rest,当我准备从GoogleChrome的高级rest控制台POST请求中获取json时,我将获取整个数据作为键,空字符串作为值 我的json是: { "school_id" : "1", "registration_no" : "", "first_name" : "Anmol", "middle_name" : "987686853", "last_name" : "", "student_category_id" : "null", "da

当我准备从GoogleChrome的高级rest控制台POST请求中获取json时,我将获取整个数据作为键,空字符串作为值

我的json是:

{
    "school_id" : "1",
    "registration_no" : "",
    "first_name" : "Anmol",
    "middle_name" : "987686853",
    "last_name" : "",
    "student_category_id" : "null",
    "date_of_birth" : "1991-01-01",
    "gender" : "MALE",
    "street_address" : "",
    "student_city" : "",
    "student_state" : "",
    "student_country" : "",
    "pin_code" : "",
    "religion" : "",
    "nationality" : "",
    "phone_number" : "",
    "mobile_number" : "987686853",
    "email" : "ab@cd.ef",
    "previous_institution_name" : "BFCET",
    "board" : "g",
    "latest_course" : "grapes",
    "passing_year" : "675",
    "percentage_marks" : "56",
    "course" : "1",
    "batch" : "2",
    "image" : "null",
    "is_active" :" true"
}
要获取此json,我将使用views.py文件中的代码:

def create(self, request):

        data=request.POST
        print data
        print "school_id",data.get('school_id')
但通过这个,我得到了多值错误:

我正在使用django restframework、python。

导入json 并且data=json.loadsrequest.body而不是data=request.POST


您的数据将出现在request.body中。我假设这不是表单提交Ajax调用。

是否打印了数据。里面有什么?