Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Commit

Permalink
Updated default Json::decode type
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-P committed Aug 13, 2014
1 parent f657abd commit 5315bdc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/languages/en/modules/zend.json.objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ to *PHP*'s associative array. Some suggest that a class identifier should be pas
class should be created and populated with the key/value pairs of the *JSON* object; others feel this could pose a
substantial security risk.

By default, ``Zend\Json\Json`` will decode *JSON* objects as associative arrays. However, if you desire an object
returned, you can specify this:
By default, ``Zend\Json\Json`` will decode *JSON* objects as ``stdClass`` objects. However, if you desire an
associative array returned, you can specify this:

.. code-block:: php
:linenos:
// Decode JSON objects as PHP objects
$phpNative = Zend\Json\Json::decode($encodedValue, Zend\Json\Json::TYPE_OBJECT);
// Decode JSON objects as PHP array
$phpNative = Zend\Json\Json::decode($encodedValue, Zend\Json\Json::TYPE_ARRAY);
Any objects thus decoded are returned as ``stdClass`` objects with properties corresponding to the key/value pairs
Any objects thus decoded are returned as associative arrays with keys and values corresponding to the key/value pairs
in the *JSON* notation.

The recommendation of Zend Framework is that the individual developer should decide how to decode *JSON* objects.
Expand Down

0 comments on commit 5315bdc

Please sign in to comment.