JSON parse error: Unrecognized token ‘qylx‘: was expecting (‘true‘, ‘false‘ or ‘null‘)

运行代码:

register_url = 'http://XXX.XX.X.XX:9090/capi/auth-company/auth/registerCompany/9999'
register_data = {"qylx": ["14", "15"], "tyshxydm": "999909098989090091", "qymc": "暖暖03", "zzjgdm": "9099909001",
                 "fddbr": "欧阳南岸", "qyzyyw": "10", "qylsqx": "", "qyszqy": "", "qytxdz": "满洲里网红街",
                 "qylxr": "欧阳南岸", "sslsxzglbm": "LS001036", "sslsxzglbmmc": "满洲里市粮食和物资储备局",
                 "qylsqxname": "满洲里市粮食和物资储备局", "jyfwVal": ["粮油收储企业"], "shixian": ["153100"],
                 "qyszqybh": "153100", "qyzt": 2, "bgdh": "18889899123", "shi": "153100", "xian": "",
                 "orgainzeDTO": {"parentCode": "LS001036", "orgName": "暖暖"},
                 "tzQylxVOList": [{"qylxmc": "加工", "qylxbh": "14"}, {"qylxmc": "应急", "qylxbh": "15"}],
                 "userDTO": {"userMobile": "18889899123", "userType": "2", "imgsrc": "", "titlesrc": "",
                             "userLoginName": "ouyangnanan", "userPassword": "Lscbj@12345",
                             "userPasswordAgain": "Lscbj@12345", "userName": "欧阳南岸"}, "msgCode": "9999",
                 "jyfw": "[\"粮油收储企业\"]"}
res = requests.post(register_url,register_data, headers={'content-type': 'application/json;charset=UTF-8'})
# print('text解析的结果是:',res.text)
print('json解析的结果是:', res.json())

运行过程中报错如下:

json解析的结果是: {'timestamp': '2023-05-31T15:58:42.943+0800', 'status': 400, 'error': 'Bad Request', 'message': "JSON parse error: Unrecognized token 'qylx': was expecting ('true', 'false' or 'null'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'qylx': was expecting ('true', 'false' or 'null')\n at [Source: (PushbackInputStream); line: 1, column: 6]", 'path': '/auth/registerCompany/9999'}

解决方法:调整post请求的中的参数

register_url = 'http://XXX.XX.X.XX:9090/capi/auth-company/auth/registerCompany/9999'
register_data = {"qylx": ["14", "15"], "tyshxydm": "999909098989090091", "qymc": "暖暖03", "zzjgdm": "9099909001",
                 "fddbr": "欧阳南岸", "qyzyyw": "10", "qylsqx": "", "qyszqy": "", "qytxdz": "满洲里网红街",
                 "qylxr": "欧阳南岸", "sslsxzglbm": "LS001036", "sslsxzglbmmc": "满洲里市粮食和物资储备局",
                 "qylsqxname": "满洲里市粮食和物资储备局", "jyfwVal": ["粮油收储企业"], "shixian": ["153100"],
                 "qyszqybh": "153100", "qyzt": 2, "bgdh": "18889899123", "shi": "153100", "xian": "",
                 "orgainzeDTO": {"parentCode": "LS001036", "orgName": "暖暖"},
                 "tzQylxVOList": [{"qylxmc": "加工", "qylxbh": "14"}, {"qylxmc": "应急", "qylxbh": "15"}],
                 "userDTO": {"userMobile": "18889899123", "userType": "2", "imgsrc": "", "titlesrc": "",
                             "userLoginName": "ouyangnanan", "userPassword": "Lscbj@12345",
                             "userPasswordAgain": "Lscbj@12345", "userName": "欧阳南岸"}, "msgCode": "9999",
                 "jyfw": "[\"粮油收储企业\"]"}
res = requests.post(register_url, data=json.dumps(register_data), headers={'content-type': 'application/json;charset=UTF-8'})
# print('text解析的结果是:',res.text)
print('json解析的结果是:', res.json())

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值