diff --git a/reference/json/functions/json_decode.xml b/reference/json/functions/json_decode.xml new file mode 100644 index 0000000000..cbd68a0e89 --- /dev/null +++ b/reference/json/functions/json_decode.xml @@ -0,0 +1,124 @@ + + + + + json_decode + Decodes a JSON string + + + + &reftitle.description; + + mixedjson_decode + stringjson + boolassoc + + + Takes a JSON encoded string and converts it into a PHP variable. + + + + + &reftitle.parameters; + + + + json + + + The json string being decoded. + + + + + assoc + + + When &true;, returned objects will be converted into + associative arrays. + + + + + + + + + &reftitle.returnvalues; + + Returns an object or if the optional + assoc parameter is &true;, an associative + array is instead returned. + + + + + &reftitle.examples; + + + <function>json_decode</function> examples + + +]]> + + &example.outputs; + + int(1) + ["b"] => int(2) + ["c"] => int(3) + ["d"] => int(4) + ["e"] => int(5) +} + +array(5) { + ["a"] => int(1) + ["b"] => int(2) + ["c"] => int(3) + ["d"] => int(4) + ["e"] => int(5) +} +]]> + + + + + + + &reftitle.seealso; + + + json_encode + + + + + + diff --git a/reference/json/functions/json_encode.xml b/reference/json/functions/json_encode.xml new file mode 100644 index 0000000000..aa60ddf121 --- /dev/null +++ b/reference/json/functions/json_encode.xml @@ -0,0 +1,98 @@ + + + + + json_encode + Returns the JSON representation of a value + + + + &reftitle.description; + + stringjson_encode + mixedvalue + + + Returns a string containing the JSON representation of + value. + + + + + &reftitle.parameters; + + + + value + + + The value being encoded. Can be any type except + a resource. + + + + + + + + + &reftitle.returnvalues; + + Returns a JSON encoded string on success. + + + + + &reftitle.examples; + + + A <function>json_encode</function> example + +1,'b'=>2,'c'=>3,'d'=>4,'e'=>5); + +echo json_encode($arr); +?> +]]> + + &example.outputs; + + + + + + + + + &reftitle.seealso; + + + json_decode + + + + + +