Top "Gson" questions

Gson is Google's open-source library for serializing and deserializing Java objects to/from JSON.

GSON issue with String

String s = "m\\"+"/m\\/m/m/m/m/m"; LinkedHashMap<String, String> hm = new LinkedHashMap<>(); hm.…

java gson linkedhashmap
Gson serialize a list of polymorphic objects

I'm trying to serialize/deserialize an object, that involves polymorphism, into JSON using Gson. This is my code for serializing: …

java json serialization gson
Can you avoid Gson converting "<" and ">" into unicode escape sequences?

I noticed that Gson converts the string "<" into an unicode escape sequence in JSON output. Can you avoid this …

java json gson
Retrofit 2 example tutorial but GsonConverterFactory display error "Cannot resolve symbol"

I'm trying to follow Retrofit's 2 tutorial, but on this part of the code there is a GsonConverterFactory that displays error …

android gson retrofit android-library okhttp
Create POJO Class for Kotlin

I want to create POJO class for Kotlin, as we know that www.jsonschema2pojo.org converts JSON to POJO …

java android gson kotlin pojo
GSON and InstanceCreator issue

I have the following POJOs: public interface Shape { public double calcArea(); public double calcPerimeter(); } public class Rectangle implement Shape { // Various …

java reflection deserialization gson type-safety
ISO 8601 with milliseconds and Retrofit

I cannot set properly the date format when using retrofit and trying to read a date like this: 2015-08-29…

java android date gson iso8601
How to iterate a JsonObject (gson)

I have a JsonObject e.g JsonObject jsonObject = {"keyInt":2,"keyString":"val1","id":"0123456"} Every JsonObject contains a "id" entry, but the …

java json gson json-deserialization
How to serialize using gson with @SerializedName annotation?

This is my first approach to serialization using Gson. I recive facebook response to my android application like this: Result: { …

java android annotations facebook-fql gson
"Unparseable date: 1302828677828" trying to deserialize with Gson a millisecond-format date received from server

After 4 hours non-stop trying to resolve the problem I have decided to ask here if someone could help me. The …

android json serialization date gson