JSON (JavaScript Object Notation) is a platform and language independent way of serializing objects into plaintext. Because it is often used on web and so is PHP, there is a basic extension for working with JSON in PHP.
Parameter | Details |
---|---|
json_encode | - |
value | The value being encoded. Can be any type except a resource. All string data must be UTF-8 encoded. |
options | Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT, JSON_PRESERVE_ZERO_FRACTION, JSON_UNESCAPED_UNICODE, JSON_PARTIAL_OUTPUT_ON_ERROR. The behaviour of these constants is described on the JSON constants page. |
depth | Set the maximum depth. Must be greater than zero. |
json_decode | - |
json | The json string being decoded. This function only works with UTF-8 encoded strings. |
assoc | Should function return associative array instead of objects. |
options | Bitmask of JSON decode options. Currently only JSON_BIGINT_AS_STRING is supported (default is to cast large integers as floats) |