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 GSON JsonParser is GSON's tree parser which parses JSON into a tree structure (of Java objects). This GSON JsonParser tutorial shows you how to use the JsonParser in practice.
🌐
HowToDoInJava
howtodoinjava.com › home › gson › gson jsonparser
Gson JsonParser (with Examples) - HowToDoInJava
April 4, 2023 - Java program to parse JSON into JsonElement (and JsonObject) using JsonParser and fetch JSON values using keys. import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; public class JsonElementExample { public static void main(String[] args) { String json = "{'id': 1001, " + "'firstName': 'Lokesh'," + "'lastName': 'Gupta'," + "'email': 'howtodoinjava@gmail.com'}"; JsonElement jsonElement = JsonParser.parseString(json); JsonObject jsonObject = jsonElement.getAsJsonObject(); System.out.println( jsonObject.get("id") ); System.out.println( jsonObject.get("firstName") ); System.out.println( jsonObject.get("lastName") ); System.out.println( jsonObject.get("email") ); } }
🌐
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
🌐
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. 1. JsonReader Read More : Streaming parser of XML 2. Tokens In streaming mode, every JSON data is considered ...
🌐
GitHub
google.github.io › gson › UserGuide.html
Gson User Guide | gson
Use Gson’s parser API (low-level streaming parser or the DOM parser JsonParser) to parse the array elements and then use Gson.fromJson() on each of the array elements.This is the preferred approach. Here is an example that demonstrates how to do this. Register a type adapter for Collection.class ...
🌐
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) ...
🌐
Baeldung
baeldung.com › home › json › convert string to jsonobject with gson
Convert String to JsonObject with Gson | Baeldung
May 5, 2025 - First, we’ll need to include ... The first approach we’ll examine for converting a JSON String to a JsonObject is a two-step process that uses the JsonParser class....
Find elsewhere
🌐
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
Bookmarks · 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.go...
🌐
HowToDoInJava
howtodoinjava.com › home › gson › gson tutorial: read and write json with examples
Gson Tutorial: Read and Write JSON with Examples
August 27, 2023 - Excluding Fields From Serialization and Deserialization – Gson supports numerous mechanisms for excluding top-level classes, fields and field types. Learn how to use them. JsonReader – Streaming JSON parser – Learn to read a JSON string or file as a stream of JSON tokens. JsonParser, ...
🌐
ZetCode
zetcode.com › java › gson
Java Gson - JSON serialization and deserialization in Java with Gson
October 10, 2024 - Gson tutorial shows how to work with JSON in Java using Gson library. We use three different Gson APIs to work with JSON.
🌐
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...
🌐
Baeldung
baeldung.com › home › json › using static methods instead of deprecated jsonparser
Using Static Methods Instead of Deprecated JsonParser | Baeldung
June 20, 2024 - Efficient JSON parsing is one of the most important tasks in Java programming when it comes to data manipulation and communication. The Gson library offers a versatile JsonParser class to simplify the conversion process.
🌐
Twilio
twilio.com › en-us › blog › developers › tutorials › building-blocks › java-json-with-gson
Two ways to use Gson for JSON in Java | Twilio
June 13, 2025 - JsonParser parser = new JsonParser(); JsonElement neoJsonElement = parser.parse(SourceData.asString()); ... I find this code quite readable, although I don’t really think I need to know about the distinction between a JsonElement and a JsonObject ...
🌐
Jenkov
jenkov.com › tutorials › java-json › gson.html
GSON - Gson
February 18, 2016 - Google developed GSON for internal use but open sourced it later. GSON it reasonably easy to use, but in my opinion not as elegant as Jackson or Boon (the winner in my opinion). In this GSON tutorial I will take you through how to use GSON to parse JSON into Java objects, and serialize Java objects into JSON.
🌐
HowToDoInJava
howtodoinjava.com › home › gson › gson – parse json array to java array or list
Gson - Parse JSON Array to Java Array or List
April 4, 2023 - Learn to use Google GSON library to deserialize or parse a JSON array to a Java array or List object. It’s worth mentioning that JSON has only array datatype. Java has both – arrays and lists.
🌐
Medium
medium.com › @ankit.sinhal › parsing-json-with-gson-library-184d94a04dec
Parsing JSON with Gson library. In the previous article we understood… | by Ankit Sinhal | Medium
January 17, 2017 - In the previous article we understood the basics of JSON and popular libraries for JSON parsing. In this tutorial we are going to discuss about one of most important library, which most of you have used in your project development. This library is GSON developed by Google.