[英]How to parse data from json in android?
I have called webservice
from android and got a response as below..... 我从android调用了
webservice
,得到了如下的响应.....
Result from WebService = 来自WebService =的结果
11-30 13:21:16.304: DEBUG/Inside SOAP(512): JSON output {
11-30 13:21:16.304: DEBUG/Inside SOAP(512): "_str": "anyType{string\u003dImplements and Equipments; string\u003dInsurance; string\u003dIrrigation and Water; }"
11-30 13:21:16.304: DEBUG/Inside SOAP(512): }
Now I want to parse these results and store in my SQLite
database. 现在我想解析这些结果并存储在我的
SQLite
数据库中。 How it can be done? 怎么做? I need your help please...
我需要你的帮助...
I'm assuming you want to get every string that follows an "=" and precedes a ";" 我假设你想得到一个跟在“=”之后的每个字符串并在“;”之前
Here's a simple example: 这是一个简单的例子:
// This is the string you want to parse
String searchableString = "string=first; string=second; string=third";
int indexOfEqualsSign = searchableString.indexOf("=");
int indexOfSemicolon = searchableString.indexOf(";");
while (indexOfEqualsSign >= 0) {
String result = searchableString.substring(indexOfEqualsSign + 1, indexOfSemicolon);
System.out.print(result);
indexOfEqualsSign = searchableString.indexOf("=", indexOfSemicolon);
}
The output of the example looks like this: 示例的输出如下所示:
first
second
third
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.