[英]How to send Json containing xml value from POSTMAN?
I am using postman to test api.我正在使用 postman 来测试 api。 The method is POST and JSON data is:方法为POST,JSON数据为:
{ "page": "<xml> <content xs="xyz">.......</xml>" }
In body I have selected 'raw' and selected 'JSON' which automatically adds 'application/json' to the header.在正文中,我选择了“原始”并选择了“JSON”,它会自动将“应用程序/json”添加到 header。
When I send this request, I get error due to the double quotes in the <content> tag
.当我发送此请求时,由于<content> tag
中的双引号而出现错误。 Does this need handling (escaping) at input or inside the api code?这是否需要在输入或 api 代码内部处理(转义)?
You have to escape double quotes with \, eg您必须用 \ 转义双引号,例如
{"page":"<?xml version=\"1.0\"?>\n<page></page>"}
Also make sure you set HTTP header Content-Type: application/json.还要确保设置 HTTP header Content-Type: application/json。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.