I\'m requesting data from a server which returns data in the JSON format. Casting a HashMap into JSON when making the request wasn\'t hard at all but the other way seems to
Here you go:
import java.lang.reflect.Type; import com.google.gson.reflect.TypeToken; Type type = new TypeToken>(){}.getType(); Map myMap = gson.fromJson("{'k1':'apple','k2':'orange'}", type);