Solar_Json::_json_decode()
Decodes a JSON string into appropriate variable.
Parameters
(string)
$str
: String encoded in JSON format(bool)
$asArray
: Optional argument to decode as an array.
Returns
(mixed) decoded value
Description
Decodes a JSON string into appropriate variable.
Note: several changes were made in translating this method from Services_JSON, particularly related to how strings are handled. According to JSON_checker test suite from » http://www.json.org/JSON_checker/, a JSON payload should be an object or an array, not a string.
Therefore, returning bool(true) for 'true' is invalid JSON decoding behavior, unless nested inside of an array or object.
Similarly, a string of '1' should return null, not int(1), unless nested inside of an array or object.