我使用的Grails的REST客户端生成器插件(https://github.com/grails-plugins/grails-rest-client-builder)像这样:如何使用Grails REST客户端构建器插件指定内容类型?
final def rest = new RestBuilder(connectTimeout:connectTimeout, readTimeout:readTimeout)
final def resp = rest.get(uri)
因此,服务器总是返回结果为XML - 我怎么(客户端)指定我想要的结果作为JSON ?
的** “的contentType” **应该做的工作。但服务提供商是否支持JSON?如果没有,那么您必须将XML转换为JSON,或者使用XML。 – Armaiti