WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0
JSON encode an array into a string, with optional method
Return a string containing the JSON1) encoded representation of an array
$array: An array to parse
$method: Optional, output the JSON code string to represent an object or an array:
JSON encoded string
<pre><? $arr=array(); $arr['a']=1; $arr['b']=2; $arr['c']=3; print(json_encode($arr)."\r\n"); // encode as an object (default method) print(json_encode($arr,0)."\r\n"); // encode as an object print(json_encode($arr,1)."\r\n"); // encode as an array ?></pre>
The above example will output:
"$arr":{"a":1,"b":2,"c":3} "$arr":{"a":1,"b":2,"c":3} "$arr":{1,2,3]
array() - Create an array, with optional values
explode() - Turn a string into an array
implode() - Turn an array into a string