Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS5 JSON Basics

I am a newbie to JSON and after reading every article i still cannot get my hear around parsing an array from a php encoded array

I have managed to get it to parse the array if it only has one item init. but if has multiple items it out puts null as it has too many values stored init.

How would i go about listing the second 'message' from this array

{"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! "}

like image 914
Joe Barbour Avatar asked Feb 28 '26 21:02

Joe Barbour


1 Answers

Your array is not a valid JSON variable.

you need to split every record with comma(,). and add the square brackets

[ /your code/ ]

try this 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! "
}
]

use this link to view every json value array.

like image 176
Josua Marcel C Avatar answered Mar 02 '26 09:03

Josua Marcel C



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!