【问题标题】:GSON to server in url format?GSON 以 url 格式发送到服务器?
【发布时间】:2014-11-18 05:36:35
【问题描述】:

我已将我的 java 对象转换为 json 格式。

InetAddress address = InetAddress.getByName("D****"); 
String ipAddress= address.getHostAddress();

Gson gson = new Gson();
String json = gson.toJson(ipAddress);
System.out.println();

我需要将 json 值转换为服务器 url 格式,例如:localhost:8080/json 这样我就可以从 ajax url 中获取该值。 我怎样才能做到这一点?

【问题讨论】:

    标签: java json spring-mvc gson


    【解决方案1】:

    我明白了。

    我使用 Spring MVC 来做到这一点:

    Here is the link

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-30
      • 1970-01-01
      • 1970-01-01
      • 2013-12-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-05
      • 2021-06-22
      相关资源
      最近更新 更多