$myArr = array("apple", "banana", "mango", "jackfruit"); $toJSON = json_encode($myArr); echo $toJSON;