2
I have the following json:
{"Data" :{ "Description": "app", "Campo2": "app2", "Campo3": "app3"}, "Instring" : "1", "Token" : "Zoebarw9nimk9o"}
The "Date" field may contain 1:N fields.
To illustrate, I tried to assemble the following class structure:
class JsonDynamicData {
Map<String, String> info;
}
class JsonDynamicClass {
JsonDynamicData Data;
int inString;
String token;
public JsonDynamicClass() {
Data = new JsonDynamicData();
}
}
private void jsonDinamico() {
//TODO
try {
String json = IOUtils.toString(getActivity().getResources().openRawResource(R.raw.jsonmoredata));
JsonDynamicClass toJson = new Gson().fromJson(json, JsonDynamicClass.class);
} catch (IOException e) {
}
}
However the conversion of Json to my object did not work.
How should I proceed to create an object structure where the "Date" field can receive 1:N fields?