google / gson

A Java serialization/deserialization library to convert Java Objects into JSON and back
Apache License 2.0
23.13k stars 4.27k forks source link

Just a Question for nested JSON #2705

Closed NicosNicolaou16 closed 2 weeks ago

NicosNicolaou16 commented 2 weeks ago

Hello, Is there a way to serialize a three times nested JSON as a flat, I mean to get the specific value directly to avoid create nested models? I searched about it but I didn't find anything clear! Thank you!

eamonnmcmanus commented 2 weeks ago

This kind of question is probably better asked on somewhere like StackOverflow. One thing you can try is something like new Gson().fromJson(myString, JsonElement.class), which will give you a JsonElement. You can then explore that JsonElement via its methods to get to the data you are interested in.

NicosNicolaou16 commented 2 weeks ago

Thank you for your response.