I had this error when upgrading a Drupal 9 installation to PHP8:

Deprecated function: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in

Original code

json_decode($tempstore->get('simulation_ids'))

Solution

PHP8 does not accept null values inside json_decode. So make sure it exists:

if ($tempstore->get('simulation_ids')) {
  json_decode($tempstore->get('simulation_ids'))
}