0

I want to know what is the different between obj.attr and obj["attr"].

Reasoning i am asking this question is, in one of the project i worked, we were invoking a post Rest API to send data in json format. Every time we used obj["attr"] to prepare json request and send to* backend server (gunicorn)*, Server replied with HTTP 500 291 error code. and when used obj.attr=value to prepare json request it worked.

when i replaced backend server of gunicorn with nodejs/SOAP Mockserver it worked

Rajesh
  • 24,354
  • 5
  • 48
  • 79
Imran
  • 1
  • 4
  • 1
    `obj["attr"]` is equal to `obj.attr` but `obj[attr]` is not same as `obj.attr` – Rajesh Mar 30 '16 at 14:27
  • 1
    You should provide a complete example in code that reproduces the issue. Otherwise, it is very unlikely that this question can be answered as written. – apsillers Mar 30 '16 at 14:28
  • Post the request data going to server in both of your case? – Dhiren Mar 30 '16 at 14:32
  • There are 2 answers on the same line but not specific to you question. May be you can get some help. http://stackoverflow.com/questions/4968406/javascript-property-access-dot-notation-vs-brackets http://stackoverflow.com/questions/17189642/difference-between-using-bracket-and-dot-notation – Dhiren Mar 30 '16 at 14:41

0 Answers0