1. First, you need a class to support the JSONObject class. This class requires external JAR package support. below is
Jettison-1.0.jar Pack: http://www.kuaipan.cn/file/id_21487635482542624.htm
2. The following Code demonstrates how to use
1 import org. codehaus. jettison. json. JSONException; 2 import org. codehaus. jettison. json. JSONObject; 3 4 public class HelloWorldTest {5 public static void main (String [] args) {6 String jsonStr = "{\" B _action \ ": \" xts. run \ ", \" m \ ": \" portal/report-viewer.xts \ ", \" method \ ": \" execute \ "," 7 + "\" ui. action \ ": \" run \ ", \" ui. tool \ ": \" CognosViewer \ ", \" ui. object \ ": \"/content/package [@ name = 'zjfx _ bdgc ']/report [@ name = 'a'] \ ", "8 +" \ "ZTBM \": \ "000010000200001000010000100001 \", \ "MBBM \": \ "001 \", \ "p_d \": \ "2011010000100001 \", "9 +" \ "run. prompt \ ": \" false \ ", \" ZBYQ_DJ \ ": \" 1111 \ ", \" BDGC_DYDJ \ ": \" 22222 \ ", \" BDGC_JSXZ \": \ "01 \", "10 +" \ "JSZB_BDZXS \": \ "01,02, 03 \", \ "PDXS_GYC_PDZZXH \": \ "02 \", \ "ZBYQ_BQTS1 \": \ "1 \", \ "ZBYQ_BQTS2 \": \ "2 \", "11 +" \ "ZBYQ_DTRL1 \": \ "3 \", \ "ZBYQ_DTRL2 \": \ "4 \", \ "JGJS_JTTZ1 \": \ "5 \", "12 +" \ "JGJS_JTTZ2 \": \ "6 \", \ "btnsearch \": \ "QUERY \", \ "btnreset \": \ "Reset \"} "; 13 14 try {15 JSONObject obj = new JSONObject (jsonStr ); 16 String B _action = (String) obj. get ("B _action"); 17 System. out. println (B _action); 18} catch (JSONException e) {19 e. printStackTrace (); 20} 21} 22}