如何解析Spring AMQP中的JSON对象?

问题描述 投票:3回答:2

有一个远程RabbitMQ服务器,它只允许我发送和接收消息。这意味着我无法创造任何东西。我发送了一个请求,并以JSON格式得到答案。

在我的应用程序中,我有一个简单的Receiver类:

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class Receiver {

@RabbitListener(queues = "QueueName")
    public void receive(String in) {
        System.out.println(" [x] Received '" + in + "'");
    }
}

我希望收到一个JSON对象。而不是这个我得到一堆数字:

 [x] Received '123,34,97,99,116,105,111,110,34,58,34,103,101,116,73,110,102,111,34,44,34,114,101,115,117,108,116,34,58,34,78,111,116,82,101,103,105,115,116,101,114,101,100,34,44,34,112,97,121,108,111,97,100,34,58,110,117,108,108,125'

我想这是JSON对象,但我怎样才能将它转换为可读格式?

java spring rabbitmq amqp spring-amqp
2个回答
© www.soinside.com 2019 - 2024. All rights reserved.