'How to avoid having 3 nested foreach and write better code?

I am getting some data from a big json file which is full of nested arrays. I am in a situation where I need 3 ugly foreach and I would avoid, if possible, to have such a garbage code but cannot figure out how to refactor it in a more decent way.

This is the code:

  $isFinalSale = [];
  foreach($orderCachedResponse->fulfillments as $fulFillment) {
    foreach($fulFillment->line_items as $line_item) {
      foreach($line_item->properties as $propertyEntry) {
        if($propertyEntry->name === '_final_sale') {
          array_push($isFinalSale, $line_item->id);
        }
      };
    };
  };


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source