note 112084 added to function.json-decode

From: Date: Tue, 30 Apr 2013 23:18:10 +0000
Subject: note 112084 added to function.json-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-194676@lists.php.net to get a copy of this message
json_decode_nice + keep linebreaks: function json_decode_nice($json, $assoc = TRUE){ $json = str_replace(array("\n","\r"),"\\n",$json); $json = preg_replace('/([{,]+)(\s*)([^"]+?)\s*:/','$1"$3":',$json); $json = preg_replace('/(,)\s*}$/','}',$json); return json_decode($json,$assoc); } by phpdoc at badassawesome dot com, I just changed line 2. If you want to keep the linebreaks just escape the slash. ---- Server IP: 213.172.110.14 Probable Submitter: 46.5.99.75 ---- Manual Page -- http://php.net/manual/en/function.json-decode.php Edit -- https://master.php.net/note/edit/112084 Del: integrated -- https://master.php.net/note/delete/112084/integrated Del: useless -- https://master.php.net/note/delete/112084/useless Del: bad code -- https://master.php.net/note/delete/112084/bad+code Del: spam -- https://master.php.net/note/delete/112084/spam Del: non-english -- https://master.php.net/note/delete/112084/non-english Del: in docs -- https://master.php.net/note/delete/112084/in+docs Del: other reasons-- https://master.php.net/note/delete/112084 Reject -- https://master.php.net/note/reject/112084 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#194676) next »