JSON DECODE()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to create a dynamic array (object) from a JSON formatted string

Syntax

JSON_DECODE(<expC>)

See Also

ACLASS(), ADDPROPERTY(), AMEMBERS(), COLUMNMETADATA(), COMPOBJ(), CREATEOBJECT(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, JSON_DECODE_FILE(), JSON_ENCODE(), LIST CLASSES, LOADOBJECT(), METADATA_DECODE(), METADATA_ENCODE(), METADATA_FINDTYPE(), NEWOBJECT(), OBJECT(), PRINT_JSON(), PRINT_HTML(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SQL SELECT, SOCKET_CLOSE(), SOCKET_LASTERROR(), SOCKET_OPEN(), SOCKET_PEEK(), SOCKET_READ(), SOCKET_SERVER(), SOCKET_WRITE(), TABLEMETADATA(), WITH, XML_DECODE_FILE()

Description

The JSON_DECODE() function is used to create a dynamic array (object) from the JSON formatted string, <expC>.

Example

myobj = json_decode('{"Name":"Barry", "Company":"Lianja", "Items":["One", "two"]}')
? myobj
? myobj.name
? myobj.company
? myobj.items[1]
? myobj.items[2]
Object (refcnt=1)
(
    [name] => Barry
    [company] => Lianja
    [items] => Array (refcnt=1)
        (
            [1] = One
            [2] = two
        )
)
Barry
Lianja
One
two