title: 400 bad request error in google speech recognition ajax call
body: <h2>400 bad request error in google speech recognition ajax call</h2>
  
  <p>I am getting response message as <code>Invalid JSON payload received. Unknown name "config[encoding]": Cannot bind query parameter. Field 'config[encoding]' could not be found in request message. Invalid JSON payload received. Unknown name "config[languageCode]": Cannot bind query parameter. Field 'config[languageCode]' could not be found in request message. Invalid JSON payload received. Unknown name "audio[content]": Cannot bind query parameter. Field 'audio[content]' could not be found in request message. Invalid JSON payload received. Unknown name "config[sampleRateHertz]": Cannot bind query parameter. Field 'config[sampleRateHertz]' could not be found in request message.</code></p>
  
  <p>But the same JSON payload and URL with the token key is working fine in postman.</p>
  
  <pre><code> var jsonObjects ={  "audio": {
                                  "content": mainStringBuf
                                     },
                            "config": {
                                  "encoding":"FLAC",
                                  "sampleRateHertz":16000,
                                  "languageCode":"en-US"
                                 }
                          };
  
      $(document).ready(function(){
          $('#speechID').click(function(){
         jQuery.ajax({
                    url: "https://speech.googleapis.com/v1/speech:recognize?key=myKey" ,
                    type: "POST",
                    data: jsonObjects,
                    dataType: "json",
                    beforeSend: function(x) {
                      if (x &amp;&amp; x.overrideMimeType) {
                        x.overrideMimeType("Content-Type:application/json");  
                        alert("beforeSend");
                      }
                    },
                    success: function(result) {
                      alert("result");
                    },
                    error: function(error){
                        alert("error");
                    }
          });
      });
                  });
  </code></pre>