Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3315140
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:18:54+00:00 2026-05-17T22:18:54+00:00

Very simple but didn’t have enough time to do a quick search. Kindly help

  • 0

Very simple but didn’t have enough time to do a quick search. Kindly help me with the following.

public class myKeyValue
{
    public int myKey { get; set; }
    public int myValue { get; set; }
}

IList<myKeyValue> is what gets javascript serialized.

Following is what browser gets in one of its in-memory variable.
[{"myKey":1,"myValue":7},
{"myKey":2,"myValue":286},
{"myKey":3,"myValue":200},
{"myKey":4,"myValue":176}] 

Now I simply want to access json value for the passed-in key. For example I pass 3 as a key and it returns me 200. I do not want to do it inside loop (that also will work, if there’s no other way around). Kindly reply at the earliest.

I would really appreciate your help.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:18:55+00:00Added an answer on May 17, 2026 at 10:18 pm

    in Javascript :

        yourJson = [{"myKey":1,"myValue":7},
                    {"myKey":2,"myValue":286},
                    {"myKey":3,"myValue":200},
                    {"myKey":4,"myValue":176}]
    
       alert(yourJson[3].myValue); //will output 176
       alert(yourJson["3"].myValue);//will output 176
       alert(yourJson[3].myKey);//will output 4
       alert(yourJson["3"].myKey);//will output 4
    

    And if you need hashmap in javascript look at previous answers. You best bet may be to loop through and check keyValue. Or if possible just change to zero based on yr original map.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I looked previous questions but it didn't help. I have a very simple function
i have a very simple question. i searched for it everywhere but i didn't
I have a very simple scenario but poor experience in this area and googling
I have a very simple problem but cannot find a nice solution. I have
This may be very simple question,But please help me. i wanted to know what
I have the following, very simple CFC that I'm calling with jQuery. It works
What I need is very simple but, searching the web, I didn't find any
In frame 1 of a very simple flash file, I have the following code:
This is a very simple setup, I can't believe but I didn't find anybody
I have a very simple question about transactions. (In sql server 2000, but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.