How do I parse this escaped Json with Gson java?

What you have here

"parameters": "{\"firstName\":\"someName\",\"lastName\":\"someLastName\"}",

is a JSON pair where both the name (which is always a JSON string) and the value are JSON strings. The value is a String that can be interpreted as a JSON object. So do just that

String jsonString = data.getAsJsonObject().get("parameters").getAsJsonPrimitive().getAsString(); 
JsonObject parameters = gson.fromJson(jsonString, JsonObject.class);

The following

Gson gson = new Gson();
JsonElement data = gson
        .fromJson("  {\n" + "    \"message\": \"someName someLastName has sent you a question\",\n"
                + "    \"parameters\": \"{\\\"firstName\\\":\\\"someName\\\",\\\"lastName\\\":\\\"someLastName\\\"}\",\n"
                + "    \"id\": 141\n" + "  }", JsonElement.class);
String jsonString = data.getAsJsonObject().get("parameters").getAsJsonPrimitive().getAsString(); 
JsonObject parameters = gson.fromJson(jsonString, JsonObject.class);
System.out.println(parameters);

prints the JSON text representation of that JsonObject

{"firstName":"someName","lastName":"someLastName"}

Tags:

Java

Json

Gson