array_push()期望参数1为数组null

I am trying to store a form data into an internal JSON file with this controller code

function index() {
  return view('contact_form');
}

function store(Request $request) {

    try {
        // my data storage location is project_root/storage/app/data.json file.
        $contactInfo = Storage::disk('local')->exists('data.json') ? json_decode(Storage::disk('local')->get('data.json')) : [];

        $inputData = $request->only(['name', 'email', 'message','subject']);

        $inputData['datetime_submitted'] = date('Y-m-d H:i:s');

        array_push($contactInfo,$inputData);

        Storage::disk('local')->put('data.json', json_encode($contactInfo));

        return $inputData;

    } catch(Exception $e) {

        return ['error' => true, 'message' => $e->getMessage()];

    }
}

but it still returns with this Error

array_push() expects parameter 1 to be array null given

I'm sure it's a pretty simple error but I need some help to correct it

data.json exists but is empty or contains invalid JSON.