小编sud*_*dar的帖子

如何仅使用Jackson将XML转换为JSON?

我从服务器获得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)

java xml json jackson

12
推荐指数
3
解决办法
3万
查看次数

如何在 JmsTemplate 中发送标题消息?

我正在尝试将消息头插入 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)

我需要将数据发送到标题中,客户端将为我的消息标题实现选择器。

spring camera jmstemplate spring-jms amq

7
推荐指数
1
解决办法
2146
查看次数

标签 统计

amq ×1

camera ×1

jackson ×1

java ×1

jmstemplate ×1

json ×1

spring ×1

spring-jms ×1

xml ×1