Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load json file into Laravel Controller?

I have a JSON file that I would like to load into a controller in Laravel so that I can use the data into my application.

The files path is /storage/app/calendar_Ids.json.

What is the correct way to go about doing this?

like image 570
Zach Tackett Avatar asked Mar 07 '17 15:03

Zach Tackett


1 Answers

Here, this should help you get sorted.

use Storage;

$json = Storage::disk('local')->get('calendar_Ids.json');
$json = json_decode($json, true);
like image 199
Mike Barwick Avatar answered Sep 20 '22 12:09

Mike Barwick