PHP конвертировать массив в объект json
$myArr = array("apple", "banana", "mango", "jackfruit");
$toJSON = json_encode($myArr);
echo $toJSON;
Lazy Loris
$myArr = array("apple", "banana", "mango", "jackfruit");
$toJSON = json_encode($myArr);
echo $toJSON;
json_decode('{foo:"bar"}'); // this fails
json_decode('{"foo":"bar"}', true); // returns array("foo" => "bar")
json_decode('{"foo":"bar"}'); // returns an object, not an array.