0

我已经调用了 webservice 并得到了如下响应,请告诉我如何解析它.....

FillAutoCompleteBudgetMasterItemsByMasterIdResponse{
FillAutoCompleteBudgetMasterItemsByMasterIdResult=anyType{
string=Agrochemicals; string=Certification fee; string=Consultation; 
string=Contracts; string=Electricity; string=Fertilizers; string=Fuel;
string=Implements and Equipments; string=Insurance; string=Irrigation and Water;
string=Labours; string=Machinery usage; string=Marketing; string=Other Items; 
string=Post Production; string=Repairs and Maintenance; string=Seeds/Seedlings ;
string=Services; string=Training; string=Transportation; }; }
4

4 回答 4

4

这不是一个有效的响应数据。因为它应该包含一个(键,值)。通过使用 key 我们得到值。

JSONArray arObjects = new JSONArray(Respone);for(int i = 0; i < arObjects.length(); i++)
JSONObject jOb =  arObjects.getJSONObject(i);                       
String date = jOb.getString("PublishedDate");
String price = jOb.getString("introduction");
于 2012-11-29T10:54:17.657 回答
2

这不是一个有效的 json。字符串没有被引用。

http://json.org/example.html

于 2012-11-29T10:01:45.510 回答
1

这不是有效的 json 格式..您不能使用 Json 解析...如果字符串不是有效的 json 格式,则会引发异常...封闭 [] 中的字符串在调用 josn 数组中大括号.. 封闭中的字符串{} 大括号中调用 josn 对象.. 通常 json 数组包含 josn 对象

JSONArray array= new JSONArray(jsonString);
for(i=0;i< array.length ;i++){
   JSONObject result = new JSONObject(array.get(i));
}
于 2012-11-29T10:01:40.597 回答
0

本教程可能会帮助您以一种轻松无忧的方式解析 json。请检查一下

于 2012-11-29T10:02:56.963 回答