nlohmann::json try...catch异常:[json.exception.type_error.302] type must be string, but is null

2023-05-16

这个问题是http请求body某个字段xxx参数不对(或者缺少xxx字段),然后下面程序用req[xxx]去取值的时候没有取到(为null,如果取到应该是string类型的),所以就报了这个错误

示例:

  • 正常请求
    在这里插入图片描述
  • 异常请求
    在这里插入图片描述
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

nlohmann::json try...catch异常:[json.exception.type_error.302] type must be string, but is null 的相关文章

随机推荐