【发布时间】:2016-11-16 06:34:58
【问题描述】:
我在一个带有这样的方法签名的 groovy 类中有一个休息端点......
public PostMyResponse postMyRequest(Reader arg0) throws Exception {
Reader 是一个java.io.BufferedReader。在我的发布请求中,我传入了 json。
如果我这样做,我可以看到参数(注意:我知道这是在 java 样式循环中打印出字符串。这不是我想要的)......
int value=0;
// reads to the end of the stream
while((value = arg0.read()) != -1)
{
// converts int to character
char c = (char)value;
// prints character
System.out.println(c);
我追求的是一种使用 groovy 将java.io.BufferedReader 转换为漂亮的 Json 对象然后从 json 对象中读取属性的方法?
谢谢
【问题讨论】: