I have the following json:
{"Description": "app", "Field2": "app2", "Field3": "app3"}, "InString": "1", "Token": "ZoebarW9NiMk9O"}
The "Data" field can contain 1: N fields.
For example, I tried to build 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 Json's conversion to my object did not work.
How do I proceed to create an object structure where the "Date" field can receive 1: N fields?