note 96959 deleted from function.json-decode by danbrown

From: Date: Thu, 25 Mar 2010 15:51:26 +0000
Subject: note 96959 deleted from function.json-decode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-167403@lists.php.net to get a copy of this message
Note Submitter: kishor_kn at hotmail dot com ---- /** * the decodeJSON works for the JSON string of the form * { * "7":{ * "questionId":"7", * "category":"1", * "id":"38", * "texts":"%" * }, * "6":{ * "questionId":"6", * "category":"4", * "id":"45", * "texts":"%" * } * } * @param $JSONstring * @return returns an array after successful conversion * returns false if supplied JSONstring is empty */ function decodeJSON($JSONstring) { if(!empty($JSONstring)) { $objectString = json_decode($JSONstring); $count = 0; foreach($objectString as $data) { foreach($data as $arrayIndex => $vals) { $newData[$count][$arrayIndex] = $vals; } $count++; } return ($newData); } return false; }

« previous php.notes (#167403) next »