如何在Android中阅读复杂的JSON

时间:2015-07-03 12:16:39

标签: android android-ksoap2

如果我有这个字符串:

  

anyType的{架构= {anyType的元素= anyType的{的complexType = {anyType的选择= {anyType的元素= anyType的{的complexType = {anyType的序列= {anyType的元素= anyType的{};元素= anyType的{的simpleType = {anyType的限制= anyType的{最大长度= anyType的{}; }; }; }; }; }; }; }; }; }; };的DiffGram = anyType的{DocumentElement = anyType的{MYTABLE = {anyType的USER_ID = 83; PROJECT_BY_DETAILS =将童谣改编成戏剧电影; }; MYTABLE = {anyType的USER_ID = 88; PROJECT_BY_DETAILS =测试 - 你们山蓝; }; }; }; }

如何在Android列表视图中显示它?

预期输出为:

USER_ID=83
PROJECT_BY_DETAILS=An adaptation of a nursery rhyme into a dramatic film

USER_ID=88
PROJECT_BY_DETAILS=Test - over ye mountain blue

1 个答案:

答案 0 :(得分:0)

String [] out;
Int i = 0;
//String result is your output (the code part from your question)
While(Result.indexOf("USER_ID") != -1){
Result = Result.substring(Result.indexOf ("USER_ID"),Result.length());
out[i] =  Result.substring(0,Result.indexOf(";");
Result = Result.substring(Result.indexOf (";"), Result.length());
i++;
}
//out [] is your array with the data you want to have

使用数组,您可以将数据放在listview中。 希望这会有所帮助:)