Questions tagged [gson]

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. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.

Filter by
Sorted by
Tagged with
1 vote
1 answer
213 views

Generic Class for a GSON LinkedHashMap

I originally posted this on Stack overflow and was told to post it here, so here it is. Here's the stack overflow question: https://stackoverflow.com/questions/66528393/generic-class-for-a-gson-...
FireController1847's user avatar
3 votes
2 answers
119 views

Code for saving / loading a class object

As I was advised, I broke my code into 2 classes. Could you take a look at the repository class and report what problems this code has ...
Destroyer's user avatar
  • 477
3 votes
2 answers
7k views

Call multiple asynchronous HTTP requests and wait for the result

I have a Repository class which looks like this: ...
Exprove's user avatar
  • 133
0 votes
1 answer
55 views

Get latest jsons with respect to [version and name] key in subjson in java

This is the json ...
Kishan C S's user avatar
7 votes
2 answers
1k views

Parsing and creating JSON packets

For several of my pet projects, I have had to interpret and/or send JSON WebSocket or HTTP responses in Java. I did some research and picked the library GSON to use. In each project, I have ...
Daniel Causebrook's user avatar
1 vote
1 answer
111 views

Parsing different json to one model

I have several json models which represent same logic model. e.g: {"title":"title1","years":"31"} and {"name":"title1","age":31} ...
Yarh's user avatar
  • 255
2 votes
1 answer
115 views

Improvements for ugly reflection

I have a project that uses a library to save serialized objects in items and loads them again, when needed. To do the de-/serialization, this library uses Gson. Due to how Gson works and how the ...
GiantTree's user avatar
  • 628
2 votes
1 answer
741 views

Gson to Model containing several return types for one key

i just had a problem converting the JSON from Phillips Hue Lights (Response) to a Model. Since it may contain several "unknown" keys in success and/or may contain just a String for success i had to ...
Emanuel S's user avatar
  • 163
5 votes
1 answer
1k views

Keep parsing JSON response until a field becomes false using GSON

I have JSON which is coming by executing a URL. I want to store all the value of id field in a List<String> by parsing ...
arsenal's user avatar
  • 2,167
2 votes
1 answer
1k views

Class for serializing generic gson objects

I realized I had just created two classes that were virtually identical for simply saving objects to their own json files, so I've attempted to make it more generic. My only noticeable problem is ...
Daniel Wilson's user avatar
1 vote
1 answer
2k views

Google Maps coordinations JSON to object

I am trying to write a parser from JSON data which I get from Google requesting coordinates of a city, which will create my specified object structure. For parsing, I've written a custom ...
Edgar's user avatar
  • 111
5 votes
1 answer
93 views

Google Gson - adding arrays to a List

I want to make sure if it's good. Maybe there is another better solution. ...
Adamo's user avatar
  • 185
3 votes
1 answer
10k views

Recursively parsing JSON response using GSON

I have a URL which I am executing it and it is returning the below string as a JSON response. I am using GSON to parse JSON. In the below JSON, "resourceId" ...
arsenal's user avatar
  • 2,167
2 votes
1 answer
2k views

GSON parsing - nested classes or not

Today I was trying GSON after a while and went to the YQL console to run this query: ...
user2405469's user avatar