刚开始,任何便利都值得赞赏。让一个对象将其序列化到这个起始段:
[{"boo00":true,"lineItem":[{"bool00":true,"display":false,"extra00":"objectType","status":"","value":"recordType:A" }, {"bool00":true,"display":false,"extra00":"0","status":"","value":"UPC:1"},{...},{.. .}],"rowId":0,"str00":"hidden"},
该对象有四个元素:boo00
(boolean)、lineIem
(ArrayList)、rowID
(int)、str00
(String)
我有这个部分,我试图了解如何重建我的对象
String flatten = lines.toString();
JSONObject outer = JSONObject.fromObject(flatten);
Iterator itr04 = null;
for(itr04 = outer.entrySet().iterator(); itr04.hasNext();){
Map.Entry entry = (Map.Entry) itr04.next();
String key = (String)entry.getKey();
System.out.println("key= "+key);
}
我收到以下异常:
“net.sf.json.JSONException:JSONObject 文本必须在 [] 的字符 1 处以 '{' 开头”
在这一点上,这对我来说意义不大,因为这正是它的开始方式。