HTTP Header for JSON

To print JSON for consumption by AJAX or other web services, change the HTTP headers before output:

<?php
	header( 'Content-type: application/json' );
	echo json_encode( $json );
?>