note 110768 deleted from function.json-decode by danbrown

From: Date: Thu, 06 Dec 2012 14:05:42 +0000
Subject: note 110768 deleted from function.json-decode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-192292@lists.php.net to get a copy of this message
Note Submitter: sskaje at gmail dot com ---- A fix to colin.mollenhour.com 21-Jan-2010 02:51 http://www.php.net/manual/en/function.json-decode.php#95782 <?php function json_decode_nice($json, $assoc = FALSE){ $json = str_replace(array("\n","\r"),"",$json); $json = preg_replace('/([{,]+)(\s*)([^"]+?)\s*:/','$1"$3":',$json); return json_decode($json,$assoc); } ?> Old regexp failed when json like {aaa:[{a:1},{a:2}]}

« previous php.notes (#192292) next »