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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -