[Solved] Unable to access object of API call response.


I tried to access total response object from the response of the survey stat API call. But correct me if I’m wrong, I think there shouldn’t be key variable with space. Like [”Total Responses”]. How would I access that variables which is the child of 

object(stdClass)#660 (10)  this object.
Richard Goodchild264162 asked

    Best answer


    It’s hard to tell which language you’re using to work with this output and in what format (PHP? JSON, XML?), but keys are indeed allowed to have spaces in their name. If using PHP, you can use a string wrapped in curly braces to access these keys:

    $output = json_decode($api_surveystatistic_response);

    $total_responses = $output->data[0]->{“Total Responses”};

    Alexander Raymond answered


      Question stats

      • Active
      • Views3585 times
      • Answers1 answer
      • Followers0 followers