Android 如何使用字符串请求从JSon文件检索数据
如何获取已发送的文本Android 如何使用字符串请求从JSon文件检索数据,android,json,Android,Json,如何获取已发送的文本 JsonObject json = new JsonObject(response); JsonObject data = json.getJsonObject("data").getString("translations").getString("translated Text"); translations是一个JsonArray,因此必须将其作为数组获取 JsonObject json = new JsonObject(response); JsonObjec
JsonObject json = new JsonObject(response);
JsonObject data = json.getJsonObject("data").getString("translations").getString("translated Text");
translations
是一个JsonArray,因此必须将其作为数组获取
JsonObject json = new JsonObject(response);
JsonObject data = json.getJsonObject("data");
JsonArray transalations = data.getJsonArray("transalations");
String translatedText = transalations.getJsonObject(0).getString("translatedText");
translations
是一个JsonArray