Feeds tamper fetch data from external API I am using drupal_http_request and drupal_json_decode to retrive and parse json from an external API in the feeds tamper by using the execute php code plugin. My code is as follows:

$json = "https://api.coursera.org/api/onDemandSpecializations.v1?ids=".$field;
$response = drupal_http_request($json);
$data = drupal_json_decode($response-&gt;data);
return ($data['elements'][0]['name']);


This returns a null value.

The json is as follows:
If I'm not mistaken {} indicates that it is an object and [] means that the variable is an array, therefor, I would expect $data-&gt;elements[0]-&gt;name would be the way to get the value in your return statement.

To improve your code, I would advise to use the empty() (or isset()) functions to check whether the elements in $data exists