array encode php

PHP
<?php
...
$json_string = json_encode($data, JSON_PRETTY_PRINT);$person = array( 
    "name" => "Johny Carson", 
    "title" => "CTO"
); 
$personJSON=json_encode($person);//returns JSON string
Source

Also in PHP: