Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json数组-Blackberry_Blackberry - Fatal编程技术网

Json数组-Blackberry

Json数组-Blackberry,blackberry,Blackberry,我尝试从json数组中获取数据 String username=object.getJSONObject(“items”).getString(“f”); 但这给了我一个错误 "items.f" not found. 下面是Json数组 { “项目”:[ { “s”:“0”, “f”:“monems”, “m”:“ustad” }, { “s”:“0”, “f”:“monems”, “m”:“那里?” }, { “s”:“0”, “f”:“mon

我尝试从json数组中获取数据

String username=object.getJSONObject(“items”).getString(“f”);
但这给了我一个错误

"items.f" not found. 
下面是Json数组

{
“项目”:[
{
“s”:“0”,
“f”:“monems”,
“m”:“ustad”
},
{
“s”:“0”,
“f”:“monems”,
“m”:“那里?”
},                      
{
“s”:“0”,
“f”:“monems”,
“m”:“发生了什么事?”
},                      
{
“s”:“2”,
“f”:“monems”,
“m”:“于5月20日凌晨4:03发送”
}        
]
}
试试这个-

JSONArray items=object.getJSONArray("items");
for(int i=1;i<=items.length();i++){
    JSONObject jsonObj=items.getJSONObject(i); 
    String s=jsonObj.getString("f");

}

JSONArray items=object.getJSONArray(“items”);

for(int i=1;iJSONArray items=object.getJSONArray(“items”);for(int i=1;iThanks@Signare。当我使用字符串f=items.getString(“f”);“类型JSONArray中的方法getString(int)不适用于参数(String)”。JSONObject jsonObj=items.getJSONObject(i);字符串s=jsonObj.getString(“s”);循环可能应该从0到
项。长度()-1