note 102628 deleted from function.json-encode by crell

From: Date: Thu, 30 Jun 2022 19:43:37 +0000
Subject: note 102628 deleted from function.json-encode by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218788@lists.php.net to get a copy of this message
Note Submitter: Mathias Leppich ---- If you need a json_encode / json_decode which is array/object/assoc-array you might want to use: http://gist.github.com/820694 <?php $dataIn = (object)array( "assoc" => array("cow"=>"moo"), "object" => (object)array("cat"=>"miao"), ); /* == IN object(stdClass)#2 (2) { ["assoc"]=> array(1) { ["cow"]=> string(3) "moo" } ["object"]=> object(stdClass)#1 (1) { ["cat"]=> string(4) "miao" } } == JSON {"assoc":{"_PHP_ASSOC":{"cow":"moo"}},"object":{"cat":"miao"}} == OUT object(stdClass)#4 (2) { ["assoc"]=> array(1) { ["cow"]=> string(3) "moo" } ["object"]=> object(stdClass)#7 (1) { ["cat"]=> string(4) "miao" } } */ ?>

« previous php.notes (#218788) next »