package test;

import java.util.Iterator;
import java.util.Set;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;


public class t1 {

	public static void main(String[] args) {
		
		
		String str="{\"houseBasicInfo\": {\"address\": \"***&*&*&87\",\"area\": \"北京市\",\"cardPic\": \"cardpiccardpiccardpic\",\"city\": \"北京市\",\"contract\": \"contract\",\"contractNo\": \"100000004\",\"idNo\": \"11022119811222061X\",\"name\": \"姚帅\",\"payAmount\": 10000,\"phone\": \"13910960649\",\"rentBegin\": \"2017-07-21\",\"rentEnd\": \"2018-07-21\",\"rental\": 5000,\"rentalType\": 1,\"roomId\": \"11\",\"roomNum\": \"1101室\",\"suiteId\": \"111\",\"termNum\": 12,\"thirdUserId\": \"1\",\"timeStamp\": \"123123123\"},\"merchantName\": \"蛋壳第一商户\",\"receiveContractInfo\": {\"area\": \"北京\",\"attachment\": \"attachment\",\"city\": \"北京\",\"contractNo\": \"0000001231231231\",\"endTime\": \"2017-07-21\",\"personIdNo\": \"110102198907132328\",\"personName\": \"小五\",\"rentalAddress\": \"北京市朝阳区银河SOHO1101室\",\"startTime\": \"2018-07-21\",\"subCompany\": \"蛋壳租房\"},\"source\": 0}";
		
		 JSONObject jo = JSONObject.fromObject(str); 
		 System.out.println(jo.getString("houseBasicInfo"));
		 
		 JSONObject j1 = JSONObject.fromObject(jo.getString("houseBasicInfo"));
		 System.out.println(j1.getString("address"));
		 System.out.println(j1.getString("area"));
		 System.out.println(j1.getString("cardPic"));
		 System.out.println("====================================");
		 System.out.println(jo.getString("merchantName"));
		 System.out.println(jo.getString("receiveContractInfo"));
		 System.out.println(jo.getString("source"));
//		 Iterator it=jo.keys();
//		 String key=null;
//		 String value=null;
//		 while(it.hasNext()){
//			 key=(String)it.next();
//			 value=jo.getString(key);
//			 System.out.println(value);
//		 }
//		JSONObject obj = JSONObject.fromObject(str); 
//		String showapi=obj.getString("showapi_res_body");
//		JSONObject obj1 = JSONObject.fromObject(showapi); 
//		 System.out.println(obj1.get("Result"));
		 
		 
//		 JSONArray transitListArray = obj.getJSONArray("showapi_res_body");  
//		 System.out.println(transitListArray.getString("Result"));
//         for (int i = 0; i < transitListArray.size(); i++) {  
//             System.out.print("Array:" + transitListArray.getString(i) + " ");  
//         }  
//		 System.out.println(jo.getString("Result"));
		 
		 
		 
//         System.out.println(jo.get("list"));
//         JSONObject jo1 = (JSONObject)jo.get("list");
//         System.out.println(jo1.get("phone"));
         
	}
}
