Answer the question
In order to leave comments, you need to log in
How to add a custom mapper for a type in Gson?
I need to add a custom mapper for a type in gson. It is outdated in the library that I use, so I want to create my own and set it to Gson so as not to modify the library code.
Answer the question
In order to leave comments, you need to log in
Usually so. Does not work? Then to be more specific...
Gson parser = new Gson(); // create json parser
Type type = new TypeToken<Map<String, MyData[]>>(){}.getType(); // create custom type
Map<String, MyData[]> data = parser.fromJson(json, type); // parse data to
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question