Java tutorial
//package com.java2s; import android.text.TextUtils; import com.google.gson.Gson; public class Main { private static Gson gson = null; public static Object jsonToBean(String jsonStr, Class<?> cl) { Object obj = null; if (gson != null && !TextUtils.isEmpty(jsonStr)) { obj = gson.fromJson(jsonStr, cl); } return obj; } }