How to decode Google spreadsheet's Json respose as a Php Array

Posted by Mohammad on Stack Overflow See other posts from Stack Overflow or by Mohammad
Published on 2010-01-11T19:38:09Z Indexed on 2010/06/09 1:12 UTC
Read the original article Hit count: 460

Filed under:
|
|
|
|

My google Docs Spreadsheet call returns this response in the json format
(I only need everything after "rows") please look at the formatted response here : )

I use php's json_decode function to parse the data and use it (Yes, I am awful at php) This code returns NULL, and according to the documentation, NULL is returned "if the json cannot be decoded".

$json = file_get_contents($jsonurl);
$json_output = json_decode($json);

var_dump ($json_output); // Returns NULL

Basically, what i want to accomplish is to make a simple array from the first row values of the Json response.

like this

$array = {'john','John Handcock','[email protected]','2929292','blanc'}

You guys are genius, I would appreciate your insight and help on this very much!

Answer as "sberry2A" mentions bellow, the response is not valid Json, google offers the Zend Json library for this purpose, tho I decided to parse the tsv-excel version instead :)

© Stack Overflow or respective owner

Related posts about php

Related posts about JSON