title: how to add string with special character as json key?
body: <p>I want to add string with special character in JSON as KEY.For example "<strong>Sam@123</strong>"
  <br>Here is the code, that I am trying.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  var jsonObj={"sam":1,"rudolph":1,"js":1," ":12};
  var key="samw@123";
  alert("Add it.")
  // Adding the key with Special Character in JSON
  eval("jsonObj."+key+"=11")
  alert("Added successfully.")
  
  for(var i=0; i&lt; Object.keys(jsonObj).length; i++){
  alert("KEY#"+Object.keys(jsonObj)[i]);
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I am getting following error at line 6 "<code>eval......</code>".</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected token ILLEGAL</p>
  </blockquote>
  
  <p>Is there any other way to add special character in Json as KEY?</p>
  
  <p>I am also not able to add </p>
  
  <pre><code>var key="samw-123";
  </code></pre>
  
  <p>for this I am getting error saying </p>
  
  <blockquote>
    <p>Uncaught ReferenceError: Invalid left-hand side in assignment</p>
  </blockquote>