2011-07-29 5 views
0

나는이안드로이드 WCF JSON 결과

{ "표"와 같이 문자열로 WCF service.That 서비스 리턴 JSON을 썼다 : [{ "BusinessUnit의": "SAMA", "WarehouseCode": "WWAT" "LocationCode": "WT03", "ProductCode": "500086", "Stock": "999.00", "LastUpdatedOn": "Jul 29 2011 11:25 AM", "LastUpdatedBy": "WAT2"}}} {{Table1 ":}} 0 {"Table1 ":}} {"Table1 ": [BatchSerialNumber": "1", "BusinessUnit": "SAMA", "DateFrom": "2011 년 5 월 5 일 12:00 AM", "DateTo ":"5 월 5 일 오후 2시 53 분 ","가격 ":"4.50 ","가격 그룹 ":"WHSL ","PricePer ":"1 ","ProductCode ":"501393 ","Quantity ":"1.00 " }, "BatchSerialNumber": "1", "BusinessUnit": "SAMA", "DateFrom": "2011 년 5 월 5 일 12:00 AM", "DateTo": "5 월 5 일 오후 2시 53 분", "가격" "PriceCount": "501817", "Quantity": "1.00"}, "가격": " { "BatchSerialNumber": "1", "BusinessUnit": "SAMA", "DateFrom": "5 월 5 2011 12:00 AM", "DateTo": "5 월 5 일 오후 2시 53 분", "가격": "44.55" , "PriceCount": "1", "ProductCode": "603973", "Quantity": "1.00"}, { "BatchSerialNumber": "1", "BusinessUnit": "SAMA" , "PriceFold": "5 월 5 일 12:00 AM", "DateTo": "5 월 5 일 오후 2시 53 분", "가격": "4.39", "PriceGroup": "WHSL", "PricePer" "제품 코드": "501736", "수량": "1.00"}

런타임은 내가 & values.How 내가 안드로이드 프로세스 methd의 필드 목록을 얻을 수 있습니다

내 코드를 [참조 필드를 알고 그 주석 장소는 호출해야합니다]

public RDAlternativeProductDetail getSoapResponseTableDataJson(SoapPrimitive node, 
    ArrayList<String> strings) throws JSONException { 
    String result = node.toString(); 
    JSONObject jsonobject = new JSONObject(result); 
    ArrayList<String> list = new ArrayList<String>(); 
    RDAlternativeProductDetail alternativeProductDetail = new RDAlternativeProductDetail(); 
    JSONArray array = jsonobject.getJSONArray("BusinessUnit"); 
    int max = array.length(); 
    for (int i = 0; i < max; i++) { 
     JSONObject tmp = array.getJSONObject(i); 
     list.add(tmp.getString("//fileds place I want to call it")); 
     ...... 
    } 
    return RDAlternativeProductDetail ; 
} 

또는 목록의 모든 입력란을 가져 오는 방법은 무엇입니까? 즉, BusinessUnit, WarehouseCode, LocationCode, ProductCode, Stock, LastUpdatedOn을 의미합니다.

도와주세요. 당신이 이에 상응하는 자바 객체에 JSON 문자열을 변환 할 같이 사전에

덕분에

+0

이 문서의 형식은 매우 좋지 않습니다. 코드 샘플에 가로 스크롤 텍스트가 없도록하십시오. – Merlin

+0

나는이 링크에서 해냈다. http://stackoverflow.com/questions/6872396/android-json-result-processing – Piraba

+0

나는 당신의 의견이 무엇을 의미하는지 이해하지 못한다. 또한 JSON이 유효하지 않습니다. http://jsonformatter.curiousconcept.com/을 사용해보십시오. – Merlin

답변