So I don't know why the `return $cached_result;` in the `else`, but if that's intentional, then you should probably do:

```php
return json_decode( $cached_result, true );
```

Because you're caching the response *body* (which is a [JSON *string*](https://i.sstatic.net/El3fc.png)) and you're reading the non-cached result like so: `$array = json_decode($result, true);`.

But if that `return` was a mistake, then this part:

```php
<?php else: ?>
	<?php return $cached_result; ?>
<?php endif; ?>
```

Should be written as:

```php
<?php else: ?>
	<?php $array = json_decode( $cached_result, true ); ?>
<?php endif; ?>
```