小编Nav*_*oss的帖子

如何使用 Python (Django) 将 x-www-form-urlencoded 转换为 json

我从 api 接收 x-www-form-urlencoded 数据。

data = 'leads%5Bstatus%5D%5B0%5D%5Bid%5D=29078079'
Run Code Online (Sandbox Code Playgroud)

当我尝试将其转换为urllib.parse.parse_qsurllib.parse.unquote 我得到一个类似的字典时

{
    "leads[status][0][id]": [
        "29078079"
    ]
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能将它转换为普通的 json 或 dict ?像这样

{
    "leads": [
       "id": "29078079"
    ]
}
Run Code Online (Sandbox Code Playgroud)

python django json x-www-form-urlencoded

5
推荐指数
1
解决办法
2368
查看次数

标签 统计

django ×1

json ×1

python ×1

x-www-form-urlencoded ×1