<?php $data = ['name' => 'John', 'age' => 35]; header('Content-type: Application/json'); echo json_encode($data);
<?PHP $data = /** whatever you're serializing **/; header('Content-Type: application/json'); echo json_encode($data);
<?php $jsonurl = "http://api.wipmania.com/json"; $json = file_get_contents($jsonurl); var_dump(json_decode($json)); ?>