问题是 json 是从 url 中获取的(我这么说是因为 url 的整个 json 内容都显示在“logcat”上),但不知何故它没有转换为“jsonarray”。
也许语法不正确或其他什么,但我已经检查了所有内容,看起来没问题,但仍然抛出此异常。
查看代码并检查 - JSONArray jArray = new JSONArray(result);
这条线可能是问题所在。“结果”是一个字符串缓冲区类型,它在函数中被转换为字符串,doInBackground
然后被发送到onPostExecute
函数,由函数接收JSONArray
,然后执行其余部分。
但据我所知,问题是将“结果”转换为JSONArray
. 这就是抛出的异常所说的。现在我添加了一行“conn.connect();” 并评论“conn.DoOutput(true)”。现在,我的整个 json 页面正在被获取并显示一条警告:“JSONObject 类型的‘整个 json 页面’的值无法转换”
非常感谢那些提供帮助的人!这是我的 JSON 文件内容 -
{
"records": [
{
"id": "1",
"Email": "cde@algowire.com",
"FirstName": "CDE",
"LastName": "CDE",
"Password": "cde",
"Category": "Chef",
"Descrption": "cde",
"Tagline": "Chef LifeStyle",
"Experience": "2 year 2 months",
"CurrentWork": "AlgowireTechnologies",
"Achievements": "got a prize ",
"Hobbies": "playing,dancing etc"
},
{
"id": "2",
"Email": "abc@algowire.com",
"FirstName": "ABC",
"LastName": "XYZ",
"Password": "abc",
"Category": "Engineer",
"Descrption": "abc",
"Tagline": "Engineer LifeStyle",
"Experience": "1 year 3 months",
"CurrentWork": "AlgowireTechnologies",
"Achievements": "got a prize ",
"Hobbies": "playing,dancing etc"
},
{
"id": "3",
"Email": "demo@algowire.com",
"FirstName": "DEMO",
"LastName": "USER",
"Password": "demo",
"Category": "Doctor",
"Descrption": "demo",
"Tagline": "Doctor LifeStyle",
"Experience": "2 year 5 months",
"CurrentWork": "AlgowireTechnologies",
"Achievements": "got a prize ",
"Hobbies": "playing,dancing etc"
},
人到中年有点甜
潇潇雨雨
慕仙森
相关分类