Java tutorial
//package com.java2s; import java.util.Map; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; public class Main { private static Gson gson = null; public static Object getJsonValue(String jsonStr, String key) { Object rulsObj = null; Map<?, ?> rulsMap = jsonToMap(jsonStr); if (rulsMap != null && rulsMap.size() > 0) { rulsObj = rulsMap.get(key); } return rulsObj; } public static Map<?, ?> jsonToMap(String jsonStr) { Map<?, ?> objMap = null; if (gson != null) { Type type = new TypeToken<Map<?, ?>>() { }.getType(); objMap = gson.fromJson(jsonStr, type); } return objMap; } }