Skip to content Skip to sidebar Skip to footer

Unable To Parse Different Json Format String Via Gson

This is not a duplicate question Please dont mark it as duplicate. Can this Json be parsed with GSON library? {'keyobject': {'keyarray': ['key1', 'key2', 'key3']}, 'valueobject': [

Solution 1:

How about this?

class Outer {
  KeyObject keyobject;
  List<ValueObject> valueobject;
}

class KeyObject {
  List<String> keyarray;
}

class ValueObject {
  List<String> valuearray;
}
Outer outer = gson.fromJson(json, Outer.class);

Post a Comment for "Unable To Parse Different Json Format String Via Gson"