← All Articles

How to Write Json in PHP

Posted on

In PHP JSON stringify and parse are part of the core libraries - however in PHP they are called jsonencode and jsondecode respectively. The latter was shown in the post about parsing json in PHP.

$arr = array("name" => "Claus Witt", "ideas" => array("one idea", "another idea"));
$json = json_encode($arr);
echo $json;