How can i get the time or the text of this json http://www.mocky.io/v2/58889af52600007c1d966456 somebody can help me ???
Asked
Active
Viewed 511 times
-8
-
8That _somebody_ could be _you_, if you put enough try. – ThisaruG Jan 25 '17 at 13:21
-
1Possible duplicate of [How to parse json parsing Using GSON in android](http://stackoverflow.com/questions/22753719/how-to-parse-json-parsing-using-gson-in-android) – Vishal Chhodwani Jan 25 '17 at 13:36
1 Answers
1
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

Arpit Jain
- 94
- 1
- 5