jquery complex json object name
<p>I refer to many sites about recursion of json as below </p>

<p><a href="http://stackoverflow.com/questions/2626773/javascript-recursion-does-not-work-properly">JavaScript recursion does not work properly</a><br>
<a href="http://stackoverflow.com/questions/2203958/jquery-recursive-iteration-over-objects">jQuery recursive iteration over objects</a></p>

<p>but most of them either knows the key or iterate using know keys. Also $.each work wells if key &amp; value are both string such as {"firstname" : "lastname"} &amp; then function (k,v) can give key &amp; value as k &amp; v respectively.</p>

<p>But in case if json object is complex &amp; we do not whats coming that is key can be any for example in JSON1 &amp; JSON2 are different in keys one, three, two in JSON1 is replaced by five, six &amp; ten in JSON2 response. </p>

<p>JSON1</p>

<pre><code>{
    "one": true,
    "three": [
        "red",
        "yellow",
        [
            "blue",
            "azure",
            "cobalt",
            "teal"
        ],
        "orange"
    ],
    "two": 19.5
}
</code></pre>

<p>JSON2</p>

<pre><code>{
    "five": true,
    "six": [
        "red",
        "yellow",
        [
            "blue",
            "azure",
            "cobalt",
            "teal"
        ],
        "orange"
    ],
    "ten": 19.5
}
</code></pre>

<p>If some how we can know the key name &amp; then compare it would be ok. easier to compare the keys, for this tagName should be work as suggested in URL below</p>

<p><a href="http://stackoverflow.com/questions/1532331/can-jquery-provide-the-tag-name">Can jQuery provide the tag name?</a></p>

<p>But for normal json object attribute tagname does not seem to work. Inspecting in firefox attributes such as text(), attr(), does not get me tagName. What I want is to loop through the json object (in practice i am using xml2json plugin to convert xml into above json format) &amp; compare key if exists and do action. I know in XML you can do the same by using nodeName. How should I do the same using JSON object. </p>
