laravel convert array to json object code example
Example 1: php convert array to json object
$myArr = array("apple", "banana", "mango", "jackfruit");
$toJSON = json_encode($myArr);
echo $toJSON;
Example 2: convert json string to json object in laravel
$manage = json_decode($request->stdin, true);
print_r($manage);
Example 3: convert php array to javascript json laravel
<script>
var js_json_obt = @json($php_array ?? '');
</scritp>