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 8476039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:04:07+00:00 2026-06-10T18:04:07+00:00

i have a JSON object something like; var data = { Name : test

  • 0

i have a JSON object something like;

 var data = {
 Name : "test name",
 Type : "test type",
 VendorInfo :{
               FirstName : "Vendor First Name",
               LastName : "Vendor Last Name",
               Address : "Vendor Address",
               City : "Vendor City",
               ZipCode : "Zip"
             }
 }

now separately i want to keep info on how to access the fields in the data var

var accessInfo=[
    { fieldName : "Name", actionName : "Edit" },
    { fieldName : "Type", actionName : "Edit" },
    :
    :etc..
 ]

now in my javascript i can iterate over the accessInfo array by a for loop, something like;

for(var i=0;i<accessInfo.length;i++){
data[accessInfo[i].fieldName] = "changed field";
}

that works fine for top level fields, but i cannot figure out how to access the fields lower down in the hierarchy.. like data.VendorInfo.FirstName, data.VendorInfo.LastName etc.

Is this at all possible? i tried putting “VendorInfo.FirstName” and [VendorInfo][FirstName], but no go..

  • 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-06-10T18:04:09+00:00Added an answer on June 10, 2026 at 6:04 pm

    You just need to parse your access specification to traverse the target object. You can use a function like this:

    function getProp(obj, propName) {
       var prop;
       var props = propName.split('.');
       for (var i = 0; i < props.length; i++) {
          prop = obj[props[i]];
          if (typeof prop === 'null' || typeof prop === 'undefined') return prop;
       }
      return prop;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a json object that looks something like this: Array ( [algorithm] =>
I have a json object like this: [{ thing: Top, data: { childs: [{
I have this Javascript data: [{id:123,type:test},{id:154,type:another}] How would you transform that into something so
I have a Javascript object like this: var jsonDataActual = { source: [{ name:
I have this json object : { msg_id:134, message:Dick, comment:[ { com_id:9, comment:test, msg_id:134,
I have a json object coming in as { c_id: 261, customer_id: 178729, name:
I have a JSON object that looks like this. [ { id : 23,
I have a json object returned from a third party api, it looks like:
I have JS code something like shown below: function ValidateBid(source, args) { var txtValue
If I have, in javascript, something like: entriesObj1 = new Object(); entriesObj1.entryId = abc;

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.