Class: atkJSON
Source Location: /utils/class.atkjson.inc
Class atkJSON
Class Overview
|
ATK JSON wrapper.
Small wrapper around the PHP-JSON and JSON-PHP libraries. If you don't have the PHP-JSON C library installed this class will automatically fallback to the JSON-PHP PHP library. It's recommended to install the C library because it's much faster. More information: - http://pear.php.net/pepr/pepr-proposal-show.php?id=198
- http://www.aurore.net/projects/php-json/
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. This feature can also be found in Python. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, TCL, and many others. These properties make JSON an ideal data-interchange language.
Located in /utils/class.atkjson.inc [line 44]
Wiki documentation
Author(s):
Information Tags:
|
Methods
|
Method Summary
| static
mixed
|
decode() |
Decode JSON string. |
| static
string
|
encode() |
Encode to JSON. |
| static
Services_JSON
|
&_getJSONService() |
Get JSON service object. This method should never be called directly! |
| void |
_utf8json() |
Convert a mixed type variable to UTF-8 |
Methods
static mixed decode(
string
$string, [boolean
$assoc = false]
)
|
|
Decode JSON string.
Parameters:
|
string |
$string: |
JSON string |
|
boolean |
$assoc: |
return as associative array (instead of objects) |
API Tags:
| Return: | PHP value |
| Access: | public |
static string encode(
mixed
$var
)
|
|
Encode to JSON.
Parameters:
API Tags:
| Return: | JSON string |
| Access: | public |
static Services_JSON &_getJSONService(
[bool
$assoc = false]
)
|
|
Get JSON service object. This method should never be called directly!
Parameters:
|
bool |
$assoc: |
return as associative array (instead of objects) |
API Tags:
| Return: | JSON service object |
| Access: | private |
Information Tags:
void _utf8json(
mixed
$data, [
$depth = 0]
)
|
|
Convert a mixed type variable to UTF-8
Parameters:
|
mixed |
$data: |
PHP variable |
|
|
$depth: |
|
API Tags:
Constants
Maximum recursion depth for conversion of data for encoding to UTF-8