json encode online code example

Example 1: php json encode

$person = array( 
    "name" => "Johny Carson", 
    "title" => "CTO"
); 
$personJSON=json_encode($person);//returns JSON string

Example 2: json encode

<?php
$age = {"numberPlate":"CPV453","documentType":null,"documentNumber":"12962552","email":"[email protected]","phone":"","entityId":"45500","contactId":"7825235","respCaptcha":"","runtVehicleConfiguration":null}

  
echo json_encode($age);
?>

Example 3: json encode

<?php
$age = array("Peter"=>35, "Ben"=>37, "Joe"=>43);

  
echo json_encode($age);
?>

Tags:

Php Example