我想将JSON保存在Django字段中,如下所示:
sox -w in.wav -r 80000 -A out.wav
但社交链接可以像以下一样保存:
{
"first_name": "bgbg",
"last_name": "hbbgh",
"username": "reza",
"user_profile": {
"id": "1ac3ca9c-563e-4f78-b9fa-01552a30585d",
"gender": "M",
"birthday": "2015-09-04",
"country": "Iran",
"city": "Tehran",
"street_address": "dsafrfl",
"state": "dskj",
"about": "fdgrdshrbfr",
"social_links": {"linkedin": "http://linkedin.com"},
"location": "11,22",
"avatar": "http://127.0.0.1:8000/media/user/1ac3ca9c-563e-4f78-b9fa-01552a30585d/avatar/1ac3ca9c-563e-4f78-b9fa-01552a30585dBooking.gif",
"verification_code": "9469"
}
我正在使用Django REST框架
"social_links": "{\"linkedin\": \"http://linkedin.com\"}",
答案 0 :(得分:0)
你应该解析你的json数据然后用(objects.create)命令保存。
你也可以使用" Django rest-framework"串行器。