I am trying to parse a json string to java object. Currently the code is manually reading file and generating java object. However, I am looking to take the implementation to gson.
Here is the json that I receive from the web service call:
{ "comment": [
"This file is used to define the behavior for the elements parsed.",
"Each entry in the file will have the format of element:name, skip:bool",
"If SkipFlag is true, it means that element need not be processed.",
"Convention used for elements and rule names is camelCase"
],
"rules": [ { "element": "html", "skip": true },
{ "element": "head", "skip": true },
{ "element": "head", "skip": true },
{ "element": "body", "skip": true }
]
}
I need to ignore the comments and convert rules. Here is the java type I am trying to define for rules java object:
// Arraylist < Map < elementname, Map < name, value > > >
ArrayList< Map<String, Map<String, String> > > rules;
Is there an easy way of doing this with gson?