我是 JSON 的新手,在阅读了每一篇文章后,我仍然无法从 php 编码数组中解析数组
如果数组只有一项初始化,我已经设法让它解析数组。但如果有多个项目,它会输出 null,因为它在 init 中存储了太多值。
我如何列出该数组中的第二条“消息”
{"date":"Friday 10 Aug 2012","time":"2:08","message":"Well guys the new website is almost compete' then again its never going to be complete it will build and build until it takes over!"}{"date":"Wednesday 8 Aug 2012","time":"9:08","message":"Mr brainwash interview yesterday left my shattered. Was so good and I had been so stressed waiting to get it. Yes 55rocks! "}
最佳答案
您的数组不是有效的 JSON 变量。
您需要用逗号(,)分隔每条记录。并添加方括号
[ /your code/ ]
尝试此代码,
[
{
"date": "Friday 10 Aug 2012",
"time": "2:08",
"message": "Well guys the new website is almost compete' then again its never going to be complete it will build and build until it takes over!"
}
,
{
"date": "Wednesday 8 Aug 2012",
"time": "9:08",
"message": "Mr brainwash interview yesterday left my shattered. Was so good and I had been so stressed waiting to get it. Yes 55rocks! "
}
]
使用这个link查看每个 json 值数组。
关于iphone - iOS5 JSON 基础知识,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11918457/