title: how to reference a JSON object element by column
body: <p>I'm scraping some code together from samples on the web that takes a single row of data (returned row from SP) and uses JSON object serializer to send it back to the client aspx javascript page. To give you an idea of how the data is being built...</p>
  
  <pre><code>    public static string GetLogEntry(DataTable table, string id)
      {
          JavaScriptSerializer jss = new JavaScriptSerializer();
          List&lt;Dictionary&lt;string, object&gt;&gt; rows = new List&lt;Dictionary&lt;string, object&gt;&gt;();
          Dictionary&lt;string, object&gt; row;
  
         foreach (DataRow dr in table.Select("UID =" + id))
         // foreach (DataRow dr in table.Rows)
          {
              row = new Dictionary&lt;string, object&gt;();
              foreach (DataColumn col in table.Columns)
              {
                  row.Add(col.ColumnName, dr[col]);
              }
              rows.Add(row);
          }
         var json = jss.Serialize(rows);
         return json;
  </code></pre>
  
  <p>I understand I have an unnecessary loop here because this particular SP is only designed to return a single row. I'll be working on that in the next chapter. My real issue is I don't understand how to extract the data I need.</p>
  
  <p>My client loop is returning the data but I'm having a hard time referencing specific column data individually.</p>
  
  <pre><code>success: function (json) {    //ajax call success function
     var obj = jQuery.parseJSON(json);    // this line isn't really doing anything right now
     eval("var datax = " + json); 
     for (var propertyName in $(datax)[0]) {
        alert('data: ' + propertyName ); }    //this returns only the column names
  
  
     $(data).each(function (key, val) {
  
     for (var propertyName in val) {
        alert('data: ' + val[propertyName]); }
  </code></pre>
  
  <p>So what I'm wanting to do is access an element by the column name like I've seen in other examples.... </p>
  
  <pre><code>alert(json.columnName) //returns undefine.
  </code></pre>
  
  <p>Thanks in advance for your time.</p>