I have a POJO class as:
public class D{ private JSONObject profileData; public JSONObject getProfileData () { return profileData; }
You don't need to use Gson to convert hashmap to a json object. Simply use:
Gson
profileDataInJson = new JSONObject(map);