测试接口时服务器端出现错误:
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line x column y (char z)
是后端在处理json对象时会将json对象转换为字典再执行其他逻辑,json属性名必须用双引号包裹,所以单纯的用单引号,结果报错
以下是原json
{
'items': [{'datapack_id':111,'revision_id':222},{'datapack_id':333,'revision_id':444}],
'confirm': true
}
更改后正确的json
{
"items": [{"datapack_id":111,"revision_id":222},{"datapack_id":333,"revision_id":444}],
"confirm": true
}