【发布时间】:2017-06-10 16:37:12
【问题描述】:
我怎样才能得到时间或文字 这个json http://www.mocky.io/v2/58889af52600007c1d966456 有人可以帮助我吗???
【问题讨论】:
-
如果你足够努力,那somebody可能就是you。
标签: java android android-studio
我怎样才能得到时间或文字 这个json http://www.mocky.io/v2/58889af52600007c1d966456 有人可以帮助我吗???
【问题讨论】:
标签: java android android-studio
public String parse(String jsonLine) {
JsonElement jelement = new JsonParser().parse(jsonLine);
JsonObject jobject = jelement.getAsJsonObject();
jobject = jobject.getAsJsonObject("data");
JsonArray jarray = jobject.getAsJsonArray("translations");
jobject = jarray.get(0).getAsJsonObject();
String result = jobject.get("translatedText").toString();
return result;
} //jsonLine refer to json
【讨论】: