I have a json string which is resulted by an ajax call which looks like this
[ {
"name":"sourabh",
"userid":"soruabhbajaj",
"id":"11",
"has_profile_image":"0" },
{
"name":"sourabh",
"userid":"sourabhbajaj",
"id":"12",
"has_profile_image":"0"
}]
The page on my web app uses “id” value as the identification of an object. So I want to display the name of the user where ever users’ name is required. What is the fastest way of getting the right user object to output the name or other values of user using the id value. Thanks in advance.
Ok… this answer provides for a lot of overhead at the start, but then makes it faster to reference by id later. It basically makes an array that has each item at the same index of its id. Like I said, a lot of overhead at first but little for later processing