In PHP, variables cannot start with a digit, so you have to access it this way:
$APIRESULT->custom_fields->{'0'}->name // Access name
$APIRESULT->custom_fields->{'1'}->caption // Access something else
The solution should work, however I dislike the structure of that data as in my opinion arrays
should be used instead of objects' properties to store some data such as several headings, etc