json_encode

(no version information, might be only in CVS)

json_encode -- Returns the JSON representation of a value

Описание

string json_encode ( mixed value )

Returns a string containing the JSON representation of value.

Список параметров

value

The value being encoded. Can be any type except a resource.

Возвращаемые значения

Returns a JSON encoded string on success.

Примеры

Пример 1. A json_encode() example

<?php
$arr
= array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);

echo
json_encode($arr);
?>

Результат выполнения данного примера:

{"a":1,"b":2,"c":3,"d":4,"e":5}

Смотрите также

json_decode()