note 110522 rejected from function.json-decode by googleguy

From: Date: Thu, 01 Nov 2012 20:55:01 +0000
Subject: note 110522 rejected from function.json-decode by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-191630@lists.php.net to get a copy of this message
Note Submitter: benkuhl at gmail dot com ---- Do not rely on json_decode to validate your JSON. The following JSON string was decoded incorrectly when I would've expected it to throw an error... { "request": { "filterBy": "MCC" //missing a comma "startDate": "Sun, 02 Sep 2012 12:51:44 -0400", "endDate": "Tue, 02 Oct 2012 00:00:00 -0400" } } Item was decoded as... array( "request" => array( "filterBy" => "Sun, 02 Sep 2012 12:51:44 -0400", "endDate" => "Tue, 02 Oct 2012 00:00:00 -0400" ) ) Notice there's no start date

« previous php.notes (#191630) next »