What is the best way to convert a JSON code as this:
{
\"data\" :
{
\"field1\" : \"value1\",
\"field2\" : \"value2\"
}
}
I like google gson library.
When you don't know structure of json. You can use
JsonElement root = new JsonParser().parse(jsonString);
and then you can work with json. e.g. how to get "value1" from your gson:
String value1 = root.getAsJsonObject().get("data").getAsJsonObject().get("field1").getAsString();