This is simple code to do it, I avoided all checks but this is the main idea.

 public String parse(String jsonLine) {
    JsonElement jelement = JsonParser.parseString(jsonLine);
    JsonObject  jobject = jelement.getAsJsonObject();
    jobject = jobject.getAsJsonObject("data");
    JsonArray jarray = jobject.getAsJsonArray("translations");
    jobject = jarray.get(0).getAsJsonObject();
    String result = jobject.get("translatedText").getAsString();
    return result;
}

To make the use more generic - you will find that Gson's javadocs are pretty clear and helpful.

Answer from MByD on Stack Overflow
🌐
Jenkov
jenkov.com › tutorials › java-json › gson-jsonparser.html
GSON - JsonParser
January 27, 2021 - The parsing of the JSON happens in the third line of code, by calling parse() on the JsonParser, passing as parameter a reference to the JSON string (or stream) to parse. The parsed JSON tree structure consists of objects from the GSON API.
🌐
HowToDoInJava
howtodoinjava.com › home › gson › gson jsonparser
Gson JsonParser (with Examples) - HowToDoInJava
April 4, 2023 - Java program to parse JSON into ... JsonElementExample { public static void main(String[] args) { String json = "{'id': 1001, " + "'firstName': 'Lokesh'," + "'lastName': 'Gupta'," + "'email': 'howtodoinjava@gmail.com'}"; JsonElement ...
🌐
Javadoc.io
javadoc.io › doc › com.google.code.gson › gson › latest › com.google.gson › com › google › gson › JsonParser.html
JsonParser - gson 2.13.2 javadoc
Latest version of com.google.code.gson:gson · https://javadoc.io/doc/com.google.code.gson/gson · Current version 2.13.2 · https://javadoc.io/doc/com.google.code.gson/gson/2.13.2 · package-list path (used for javadoc generation -link option) https://javadoc.io/doc/com.google.code.gson/gson/2.13.2/package-list ·
🌐
Javadoc.io
javadoc.io › doc › com.google.code.gson › gson › 2.6.2 › com › google › gson › JsonParser.html
JsonParser - gson 2.6.2 javadoc
Bookmarks · Latest version of com.google.code.gson:gson · https://javadoc.io/doc/com.google.code.gson/gson · Current version 2.6.2 · https://javadoc.io/doc/com.google.code.gson/gson/2.6.2 · package-list path (used for javadoc generation -link option) · https://javadoc.io/doc/com.goog...
🌐
Javadoc.io
javadoc.io › static › com.google.code.gson › gson › 2.11.0 › com.google.gson › com › google › gson › JsonParser.html
JsonParser (Gson 2.11.0 API)
Here's an example of parsing from a string: String json = "{\"key\": \"value\"}"; JsonElement jsonElement = JsonParser.parseString(json); JsonObject jsonObject = jsonElement.getAsJsonObject(); It can also parse from a reader: try (Reader reader = new FileReader("my-data.json", StandardChar...
🌐
Mkyong
mkyong.com › home › java › how to parse json using gson
How to parse JSON using Gson - Mkyong.com
May 2, 2024 - <dependency> <groupId>com.goog... etc... } A simple JSON string. ... The following example uses Gson to parse JSON data and convert it to the Java object Person....
🌐
GitHub
github.com › google › gson › blob › main › gson › src › main › java › com › google › gson › JsonParser.java
gson/gson/src/main/java/com/google/gson/JsonParser.java at main · google/gson
import com.google.gson.stream.MalformedJsonException; import java.io.IOException; import java.io.Reader; import java.io.StringReader; · /** * A parser to parse JSON into a parse tree of {@link JsonElement}s. * * <p>The JSON data is parsed in {@linkplain JsonReader#setStrictness(Strictness) lenient mode}. * * <p>Here's an example of parsing from a string: * * <pre> * String json = "{\"key\": \"value\"}"; * JsonElement jsonElement = JsonParser.parseString(json); * JsonObject jsonObject = jsonElement.getAsJsonObject(); * </pre> * * <p>It can also parse from a reader: * * <pre> *
Author   google
🌐
Tabnine
tabnine.com › home page › code › java › com.google.gson.jsonparser
com.google.gson.JsonParser.parse java code examples | Tabnine
Gson gson = new Gson(); JsonParser parser=new JsonParser(); //object arr example JsonArray arr=parser.parse(mPrefs.getString("myArrKey", null)).getAsJsonArray(); events=new Event[arr.size()]; int i=0; for (JsonElement jsonElement : arr) ...
Find elsewhere
🌐
Tabnine
tabnine.com › home page › code › java › com.google.gson.jsonparser
Java Code Examples for JsonParser | Tabnine
Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonObject object1 = parser.parse(json).getAsJsonObject().getAsJsonObject("object1"); Object1 result = gson.fromJson(object1, Object1.class); int userId = object1.getAsJsonObject...
🌐
Javadoc.io
javadoc.io › doc › com.google.code.gson › gson › 2.8.6 › com.google.gson › com › google › gson › JsonParser.html
JsonParser - gson 2.8.6 javadoc
Latest version of com.google.code.gson:gson · https://javadoc.io/doc/com.google.code.gson/gson · Current version 2.8.6 · https://javadoc.io/doc/com.google.code.gson/gson/2.8.6 · package-list path (used for javadoc generation -link option) https://javadoc.io/doc/com.google.code.gson/gson/2.8.6/package-list ·
🌐
Jenkov
jenkov.com › tutorials › java-json › gson.html
GSON - Gson
February 18, 2016 - GSON can also generate JSON from Java objects. You do so via the Gson object. To generate JSON you call the toJson() method of the Gson object. Here is an example of generating JSON from a Java object with GSON:
🌐
Adobe Developer
developer.adobe.com › experience-manager › reference-materials › 6-4 › javadoc › com › google › gson › JsonParser.html
JsonParser ("The Adobe AEM Quickstart and Web Application.")
com.google.gson.JsonParser · public final class JsonParser extends java.lang.Object · A parser to parse Json into a parse tree of JsonElements · Since: 1.3 · equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait · public JsonParser() public JsonElement parse(java.lang.String json) throws JsonSyntaxException ·
🌐
Baeldung
baeldung.com › home › json › using static methods instead of deprecated jsonparser
Using Static Methods Instead of Deprecated JsonParser | Baeldung
June 20, 2024 - In conclusion, JsonParser was deprecated, and there are excellent alternative static methods provided by the Gson class, such as parseString(), parseReader(), and parseJson().
🌐
Maven Repository
mvnrepository.com › artifact › com.google.code.gson › gson
Maven Repository: com.google.code.gson » gson
September 10, 2025 - Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. ... aar android apache api arm assets build build-system bundle client clojure cloud config cran data database eclipse example extension framework github gradle groovy io ios javascript jvm kotlin library logging maven mobile module npm osgi persistence plugin resources rlang sdk server service spring sql starter testing tools ui web webapp
🌐
Medium
paul-d-chuang.medium.com › java-parsing-json-strings-with-gson-jsonobject-vs-self-defined-java-class-c5afa2fbd0c0
Java Parsing JSON strings with GSON JsonObject vs. with self-defined Java class | by Paul Chuang | Medium
May 24, 2024 - // file name: JsonTest.java package ... JsonTest{ public static void main(String[] args) { Gson gson = new Gson(); String jsonString = "{\"name\":\"Alice\",\"age\":30}"; // parse JSON string to Gson JsonObject JsonObject jsonObject ...
🌐
HowToDoInJava
howtodoinjava.com › home › gson › gson jsonreader
Gson JsonReader - Streaming JSON Parser - HowToDoInJava
April 3, 2023 - Learn to work with Gson JsonReader class which is a pull-based streaming JSON parser. It helps in reading a JSON as a stream of tokens. The JsonReader is the streaming JSON parser and an example of pull parser.