How to decode Google spreadsheet's Json respose as a Php Array
- by Mohammad
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 :)