note 121606 deleted from function.json-decode by salathe

From: Date: Mon, 21 Sep 2020 14:59:59 +0000
Subject: note 121606 deleted from function.json-decode by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215415@lists.php.net to get a copy of this message
Note Submitter: farhad0 at gmail dot com ---- Use this convertor , It doesn't fail and return null at all: https://github.com/parsmizban/services-json // create a new instance of Services_JSON $json = new Services_JSON(); // convert a complexe value to JSON notation, and send it to the browser $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); $output = $json->encode($value); print($output); // prints: ["foo","bar",[1,2,"baz"],[3,[4]]] // accept incoming POST data, assumed to be in JSON notation $input = file_get_contents('php://input', 1000000); $value = $json->decode($input); // if you want to convert json to php arrays: $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);

« previous php.notes (#215415) next »