我目前使用json_encode从jql_encode看起来像这样:
{"post_2":{"caption":"...","id":"...","accountID":"..","date":"07\/07\/2011 1:45:12 AM","title":"...","authorInfo":{"Email Address":"..."}}}, {"post_2":{"caption":"...","id":"...","accountID":"..","date":"07\/07\/2011 1:45:12 AM","title":"...","authorInfo":{"Email Address":"..."}}}
如何让json成为一组帖子('post_2','post_1')而不是字典? JSON将使用SBJSON在iPhone上解码,JSON必须在后端制作成阵列。
先谢谢。
答案 0 :(得分:3)
为json_encode()
提供非关联数组。最简单的方法通常是简单地在(关联)数组上调用array_values()
,然后对结果进行编码。
答案 1 :(得分:0)
看一下PHP的json_decode
函数,特别是第二个参数,如果你想要一个数组。