Today, We want to share with you PHP Array to JSON Array using laravel blade with @json.In this post we will show you laravel blade variable, hear for laravel blade pretty print json we will give you demo and example for implement.In this post, we will learn about laravel read json file to array with an example.
PHP Array to JSON Array using laravel blade with @json
There are the Following The simple About how to get data from json object in laravel Full Information With Example and source code.
As I will cover this Post with live Working example to develop print json data in laravel, so the Array to JSON Array using json_encode() is used for this example is following below.
How to use php array in json in laravel blade with @json
using Core PHP
<script> var app = <?php echo json_encode($listOfProductsArr); ?>; </script>
using Laravel Blade Example
<script> var app = @json($listOfProductsArr); var app = @json($listOfProductsArr, JSON_PRETTY_PRINT); </script>
I hope you get an idea about print json data in laravel.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.