php function json_decode()
Wednesday, September 17th, 2008So I was using the php function php_decode to convert a JSON encoded data result from a web service (More on that later) But it was choking on the JSON formated data result. Why? well, the C# library that I was using to generate the JSON data encoded a DateTime object as
”TimePosted”: new Date(1221571632000),
javascript picks up on the new Date function, but not PHP. so I had to switch the JSON data result to return the date as a string
”TimePosted”: “9/16/2008 1:27:12 PM”,
The website that I found in the process of finding this out might be helpful for someone else too. http://www.jsonlint.com/ a JSON validator. and it takes JSON data and make it easy to read too, that a big bonus!
That’s it. JSON on!