Questions tagged as 'gson'

1
answer

How to filter to show only the required fields in a class using Gson

I'm using Gson to work with json, let's say it has this class class Track( @SerializedName("id") val id: Long, @SerializedName("name") val name: String, @SerializedName("modality") val modality: String, @SerializedName("paper")...
asked by 13.08.2018 / 23:07
1
answer

Read json with the GSON library

How do I read this code with the GSON library? { "profissao": { "jornalista": [ "escritor", "legal", "fotografo" ], "programador": [ "focado", "exatas",...
asked by 28.08.2017 / 15:28
1
answer

Preventing an attribute from being serialized or deserialized

I'm using Gson in a web service and I need to prevent some attributes from being serialized and others that are prevented from being deserialized. One of the reasons for preventing a serialization is due to the loop that is entered when serializ...
asked by 11.05.2017 / 15:10
1
answer

Extract JSON data within JSON that comes from a Web Service serving an Android APP

Good evening, how are you? I'm developing an Android APP and it consumes data from a webservice, however I'm having trouble getting some information into the APP. This is the JSON that I return to my APP: { "cod":1 ,"dados":...
asked by 18.01.2017 / 06:39
1
answer

Gson: JsonObject conversion error for JsonArray (JsonPrivate can not be cast to com.google.gson.JsonArray)

I'm trying to convert a JSONObject item to an ArrayList and for this I created this function from an example I saw here in the forum: public static ArrayList<Produto> converte(JSONObject jsonObject){ ArrayList<ArrayList>...
asked by 05.11.2016 / 16:43
2
answers

Conflict when using Gson + Facebook API

Talk about it, all right? Has anyone used the Gson library in the same project where the SDK was used? The problem happened when I used the Facebook SDK to allow in-app login through the Facebook account. This routine also worked perfectly...
asked by 25.08.2016 / 22:33
1
answer

Error sending ArrayList via POST in Retrofit 2: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING

When I try to send an ArrayList via @POST to be saved in my webserver with Retrofit2, the ArrayList is saved, however I am getting the following error:    java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1...
asked by 29.12.2015 / 14:34
1
answer

Converting JSON to arraylist android

Good afternoon!    I am trying to consume an API in android but I am having difficulty because in the JSON file it brings a category, I tried to add the variable "acronym" but it did not work; the JSON returned in the variable response is this:...
asked by 21.04.2018 / 22:46
1
answer

Gson Library Changing util.Date

When using the GSON library for JSON manipulation, I noticed that when parsers are done the date is being changed, it's tiny, but it's enough to break my unit test with JUnit . > Follow a sketch code to show the strange beh...
asked by 17.10.2017 / 22:12
1
answer

Convert JSON to Array in java

I have a JSON that represents a test query: {"dctitle":"TestesStatus", "oslc_cmtotalCount":2, "oslc_cmresults": [ {"dctitle":"33643640", "rdfabout":"XXXXXXXXXXX", "dbid":"XXXXXXXXXXX", "depto":"XXXXXXXXXXX", "sigla"...
asked by 13.09.2017 / 21:25