日期:2014-05-16 浏览次数:20392 次
{ "recordId":"39885", "recordName":"Record Name: host_node", "recordType":"Record Type: CI", "forSimulate":"false", "attributes": [ {"name":"TenantOwner","value":"CALI"}, {"name":"data_externalid","value":"20110422_pass"}, {"name":"node_model","value":"AIX 6.1.3.0"}, {"name":"data_origin","value":"20110422_unmatched_on_adapter"}, {"name":"vendor","value":"3COM"} ] }
public static void main(String[] args) throws Exception { JSONParser parser = new JSONParser(); // {"currentSelectedId":39855,"allSelectedIds":["39855","39856","39857"]} String s = "{\"currentSelectedId\":39855,\"allSelectedIds\":[\"39855\",\"39856\",\"39857\"]}"; JSONObject selectedRecordsJson = (JSONObject) parser.parse(s); JSONArray arrays = (JSONArray) selectedRecordsJson.get("allSelectedIds"); for (int i = 0; i < arrays.size(); i++) { System.out.println(arrays.get(i)); } }
selectedRecords={ "currentSelectedId":282906, "allSelectedIds":["282906"] } & result={ "recordId":"282906", "recordName":"Record Name: connection", "recordType":"Record Type: Relationship", "forSimulate":"false", "attributes":[{ "name":"source_citype", "value":"11"},{ "name":"destination_citype", "value":"unix" },{ "name":"data_externalid", "value":"connection-0704-aa1000011" },{ "name":"source_ciexternalid", "value":"asset-0704-aa100000eee" },{ "name":"data_origin", "value":"test" },{ "name":"destination_ciexternalid", "value":"unix-0704-y2e3eee" }] }