title: How extract value from a json object using javascript
body: <p>Following is my json object produced using php script</p>
  
  <pre><code>$to_encode[]= mysql_fetch_assoc($result);
  echo json_encode($to_encode);
  </code></pre>
  
  <p>and the output is</p>
  
  <pre><code>[{"wid":"2","repid":"1"}]
  </code></pre>
  
  <p>to extract values of <code>wid</code> and <code>repid</code> I used below given code in js</p>
  
  <pre><code>var obj = JSON.parse(data);
  
  var a = obj.["wid"];
  var b = obj.["repid"];
  </code></pre>
  
  <p>but I'm getting value for <code>a</code> and <code>b</code> as  <code>undefined</code> instead of <code>2</code>,<code>1</code> </p>