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
0
votes
0answers
34 views

Templated JSON parsing methods that work with an element or elements array

Consider the following two Java methods. The first takes a JSON string representing one element, the second representing multiple elements. gson.fromJson() can be ...
2
votes
2answers
495 views

Call multiple asynchronous HTTP requests and wait for the result

I have a Repository class which looks like this: ...
0
votes
1answer
38 views

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

This is the json ...
7
votes
2answers
328 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 ...
1
vote
1answer
81 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} ...
1
vote
0answers
37 views

Java Market Summary - JSON

I am writing a java program that will print current market values from a websites api. I used gson to parse the incoming json and Timer to run it every 5 minutes. I was wondering if this was the best ...
1
vote
0answers
94 views

Parsing .xls database export into a JSON-formatted database import

Input: Row at index 0 is always the titles of each column. Columns will always be expected to be properly arranged for the chosen format. There may be empty or incorrectly formatted ...
2
votes
1answer
93 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 ...
2
votes
1answer
285 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 ...
5
votes
1answer
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 ...
2
votes
1answer
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 ...
1
vote
1answer
1k 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 ...
5
votes
1answer
71 views

Google Gson - adding arrays to a List

I want to make sure if it's good. Maybe there is another better solution. ...
3
votes
1answer
8k 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" ...
2
votes
1answer
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: ...