DATA Methods
Database functions
select(), fetch(), write(), update(), delete(), execute(), tables(), fields()Requests and temporary storage
request(), cookie(), session(), config(), store()Formatting data
encode(), decode(), json(), text(), date(), weekday(), month()Template data
content(), parents(), directory()
json()
Creates JSON object from array. If an array's field-names isn't unique only the first occurance of that field will be used.
string json( array values )
Return
Functions returns JSON object formatted string.
Parameter
Description
valuesValues to be transformed into JSON object.
Create JSON object
$DATA->json(array("field0", "field0" => "not unique", "field1" => 0, "field2" => "STRING", "field3" => array("a", "b", "c"), "field4" => $DATA->json(array("test2" => 17)), "field5" => false, "field6" => null))
RETURN: '{"field0": "","field1": 0,"field2": "STRING","field3": ["a","b","c"],"field4": "{\"test2\": 17}","field5": false,"field6": null}'