For example, the following JSON:
{
"A" : [{
name : "admin",
email:"xxx@msn.com"
},{
name : "anly",
email:"xxx@msn.com"
}]
"B" : [{
name : "beta",
email:"xxx@msn.com"
},{
name : "b",
email:"xxx@msn.com"
}]
}
Html formatted as follows:
<ul>
<li>admin</li>
<li>anly</li>
<li>besta</li>
<li>bestb</li>
</ul>
How By clicking li, found to their corresponding object?
I think the method is:
- 1, by traversing JSON find, but this way is time-consuming, not simple
- 2, which is bound to the data key and index attributes above and through the key index to find, but if some of the more complex data structures, as too cumbersome, and do not know that there is no other better way to achieve it?
The above content is translated through Google, I do not know whether a clear description of my problem?
Here are two examples of what I wrote myself realized: