python - 如何使用 python 在 Rest API 中直接发布 json 数据
问题描述
我有一个 json 格式的响应数据,现在我想发布这个 json 格式。但是我有同样的问题。
{'u_correlationid_': '', 'resolved_by': '','active': 'true', 'upon_approval': 'proceed', 'skills': '', 'parent_incident': '', 'business_impact': '', 'sys_domain': {'value': 'global', 'link': ''}, 'made_sla': 'true', 'activity_due': '2019-11-07 10:09:15', 'opened_at': '2019-09-11 16:17:24'}
当我尝试直接发布 json 数据时出现错误:
"error": "Validation error - JSON parse error: Can not deserialize instance of java.lang.String out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@37b90445; line: 1, column: 298] (through reference chain: java.util.LinkedHashMap[\"sys_domain\"])"
我想在 Python 中修复这个错误,并用我的响应格式"
而不是'
我的响应格式发布我的 json 数据{"u_correlationid":""}
,最后我还想在发布之前将一个密钥对附加到现有的。例如-
{"u_correlationid":"",
"opened_at": "2019-09-11 16:17:24","data":"big"}
解决方案
推荐阅读
- javascript - 无法从 Angular 7 组件中的外部 jQuery 文件访问方法
- spring-boot - Spring Boot - JavaFX 应用程序不可能实现 SmartLifeCycle?
- php - 控制电子邮件登录
- ios - Ionic 4 构建不适用于 ios 10.3
- r - 如何将等值面剪辑到球上?
- javascript - sweetalert2:如何在重定向时有加载器动画
- windows - Windows - 查找注册表路径是否存在的命令
- java - 在gradle中隐藏传递依赖
- java - 如何将 localhost:8080 更改为 www.myWebApp.com?
- python - 将平面 JSON 从另一个 JSON 转换为父子关系结构