2015-07-03 61 views
-1

如果我有這個字符串:如何閱讀複雜的JSON在Android的

anyType的{模式= anyType的{元= anyType的{複雜類型= anyType的{選擇= anyType的{元= anyType的{複雜類型= 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 

回答

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。 希望這有助於:)