php - Android JSONAException value of type java.lang.String cannot be contvert to JSONArray -
at php json_encode, return
[{"item":"item1"},{"item":"item2"},{"item":"item3"}]
at eclipse, use retrieve array
string content = converter.convertstreamtostring(response.getentity().getcontent()); jsonarray jsonarray = new jsonarray(content); item = new string[jsonarray.length()]; for(int i=0; i<jsonarray.length();i++) { sonobject jsonobject = jsonarray.getjsonobject(i); item[i] = jsonobject.getstring("item"); }
however, receive
org.json.jsonexception: value item1 of type java.lang.string cannot converted jasonarray
how have fix this
i found problem already, in php file while wanted test output of array, , forgot remove echo after testing
Comments
Post a Comment