note 87756 added to function.json-decode

From: Date: Fri, 19 Dec 2008 17:50:32 +0000
Subject: note 87756 added to function.json-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-148352@lists.php.net to get a copy of this message
So sadly true, soapergem at gmail dot com. Firefox 3.0.5 saves bookmarks in an incorrect JSON format (although 3.0.4 was just fine). Thanks to bizarr3_2006 at yahoo dot com, I discovered that an extra comma was the culprit. For those interested, in order to parse the file you should do: $contents=file_get_contents($filename); $contents=str_replace(",]","]",$contents); $bookmarks=json_decode(utf8_encode($contents),true); Mauro ---- Server IP: 80.241.173.254 Probable Submitter: 151.92.176.3 ---- Manual Page -- http://www.php.net/manual/en/function.json-decode.php Edit -- https://master.php.net/note/edit/87756 Del: integrated -- https://master.php.net/note/delete/87756/integrated Del: useless -- https://master.php.net/note/delete/87756/useless Del: bad code -- https://master.php.net/note/delete/87756/bad+code Del: spam -- https://master.php.net/note/delete/87756/spam Del: non-english -- https://master.php.net/note/delete/87756/non-english Del: in docs -- https://master.php.net/note/delete/87756/in+docs Del: other reasons-- https://master.php.net/note/delete/87756 Reject -- https://master.php.net/note/reject/87756 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#148352) next »