1、json字符串為 { "key" : "value" }
import com.alibaba.fastjson.JSONObject;
//json字符號轉換為json對象,然后獲得key對應value public static String getJsonValue(String jsonStr, String key) { JSONObject jsonObj = JSONObject.parseObject(jsonStr); return jsonObj.get(key).toString(); }