1.生成JsonObject:將Java bean轉換成易於處理和傳輸的strig的key value形式。
2.解析JsonObject:將收到的字符串轉換成JsonObejct這種對象形式,JsonObject是一種json對象,作為json 字符串與JavaBean轉換的中間產物。
從http流中獲取傳輸來的json
BufferedReader reader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream())); String lines =reader.readLine();//��ȡ������ JSONObject inputJson=JSONObject.parseObject(lines); reader.close();
3.JsonObject常用方法:
1.構造JSonObject:將傳輸進來的字符串構造成JsonObject.
靜態方法JsonObject jobj = JSONObject.parseObject(string);
2.自己添加Json