我从服务器获得XML响应.但我需要以JSON格式显示它.
有没有办法在没有任何第三方API的情况下进行转换?我用过杰克逊,但为此我需要创建POJO.
服务器的响应是这样的:
<?xml version='1.0'?>
<errors><error><status>400</status><message>The field 'quantity' is invalid.</message><details><invalid_reason>The quantity specified is greater than the quantity of the product that is available to ship.</invalid_reason><available_quantity>0</available_quantity><order_product_id>12525</order_product_id></details></error></errors>
Run Code Online (Sandbox Code Playgroud) 我正在尝试将消息头插入 amq。JMSTemplate 中没有特定方法用于在 amq 中设置 header。当我这样设置时,它将保存在StringProperty而不是标题中。保存到标题如何传递数据
amqTemplate.convertAndSend(goMQ, message,new MessagePostProcessor() {
@Override
public Message postProcessMessage(Message message) throws JMSException {
message.setStringProperty("test1","testdata");
message.setStringProperty("country","US");
//setObjectProperty -- also set the string property
return message;
}
});
Run Code Online (Sandbox Code Playgroud)
我需要将数据发送到标题中,客户端将为我的消息标题实现选择器。