What is the best way to convert a JSON code as this:
{ \"data\" : { \"field1\" : \"value1\", \"field2\" : \"value2\" } }
Using the GSON library:
import com.google.gson.Gson; import com.google.common.reflect.TypeToken; import java.lang.reclect.Type;
Use the following code:
Type mapType = new TypeToken>(){}.getType(); Map son = new Gson().fromJson(easyString, mapType);