<?php $myObj = new stdClass(); $myObj->name = "Matin"; $myObj->age = 48; $myObj->city = "Mashhad"; $myJSON = json_encode($myObj); echo $myJSON; ?>