compare eval with list of dictionary on the basis of its key
<p>I have a string containing a list of dictionary.
I want to compare by checking their keys not value. is there any way to do that. </p>

<pre><code>data = '[{ "group1" : "T1"}, { "group1" : "T2"}, { "group2" : "T3"}]';
</code></pre>

<p>how can i compare these dictionaries on the basis of their keys. for example, i have used:</p>

<pre><code>dataObj = eval(data);  //generate 3 objects for data.
</code></pre>

<p>here <code>dataObj[0]</code> will refer to object of <code>{ "group1" : "T1"}</code>
to do it i have done following code:</p>

<pre><code>for(i=0;i&lt;dataObj.length;i++){
if (dataObj[i].key == dataObj[i].key){         //&lt;-- i am not getting what to do to compare their keys i.e. "group1" and "group1"
//my other statements
}
}
</code></pre>
