...

/

Understanding the API Response

Understanding the API Response

This lesson details the contents of the Speech-to-Text API response

Response diagram

The following diagram represents the structure of the response object generated by the API:

JSON representation

The message below is returned to the client through the speech.recognize method. It contains the result as zero or more sequential SpeechRecognitionResult messages.

Below is the entire JSON representation of the SpeechRecognitionResult

{
  "results": [
    {
     {
       "alternatives": [
     {
      {
        "transcript": string,
        "confidence": number,
        "words": [
          {
            {
              "startTime": string,
              "endTime": string,
              "word": string,
              "speakerTag": integer
           }
         }
       ]
      }
   }],
     "channelTag": integer
  } 
 }]
}

Response breakdown

Let’s break down how we can read the API response.

The code below stores the API call results in response:

 ...