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

  • SEARCH
  • Home
  • 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 6696243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:19:07+00:00 2026-05-26T06:19:07+00:00

So I have a JSON variable that looks like this: var peopleList = {

  • 0

So I have a JSON variable that looks like this:

var peopleList = {
    "1": {"Name": "Lisa", "item1": "Name of Item 1"}   ,
    "2": {"Name": "Marty"}   ,
    "3": {"Name": "Jordan",  "item1":"Name of Item 1",  "item2":"Name of Item 2"}
}

I guess it’s kind of like a relational database.

Basically for the scope of the program i’m trying to do I need to be able to keep adding in multiple people (1-3 in this variable) and then associate multiple items to those people.

Also for the variable as it is now i’m not even sure what the getters and setters would be in Javascript.

For example, how would I add an item to “Marty”

And how would I print out the Name for item2 from person “Jordan”

Thanks for any help. I’m still a little bit new to JSON.

And if there is a better way to do this that is easier to parse, i’m all ears.

  • 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-26T06:19:07+00:00Added an answer on May 26, 2026 at 6:19 am

    to get the value of any object with .

     peopleList[3].Name // will return Jordan
    

    to add any key value pair to any object try this

    var MartyData = peopleList[2];
    MartyData['item1'] = "Name of item 1 of Marty";
    // you can check now that data added or not
    alert(peopleList[2].item1); // return Name of item1 of marty
    

    DEMO

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

Sidebar

Related Questions

Greetings all, I have some JSON code that looks like this: { playlist: [
I have an extremely simple JSON object that looks like the following: var data
I have a JSON string that looks something like this: {addresses:{address:[{@array:true,@id:888888,@uri:xyz,household:{@id:44444,@uri:xyz},person:{@id:,@uri:},addressType:{@id:1,@uri:xyz,name:Primary},address1:xyz,address2:null,address3:null,city:xyz,postalCode:111111}]}} What would be
I have JSON object inside variable like this: var chessPieces = { p-w-1 :
I have a JSON response that looks like this. I want to extract the
I have an object that looks like this: public MyObject { public int ObjectID
I have a JAVASCRIPT array that looks like this: postarray['min_price'] = 120000; postarray['max_price'] =
Function cue.getCueAsSource(); gives me a nice and clean JSON file that looks like this:
I have an array left over after parsing JSON that looks like ( -122.1407313,
I have a JSON result that contains numerous records. I'd like to show the

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.