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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T14:43:29+00:00 2026-05-29T14:43:29+00:00

I have JSON/JS like this that populates data: var settingDefs = []; settingDefs.push({ name:’responses’,

  • 0

I have JSON/JS like this that populates data:

  var settingDefs = [];
  settingDefs.push({
    name:'responses', label:'Responses', type:'aeditor', 
    defaultValue: Object.toJSON([
      {"id":"1", "name":"Bob", "text":"Is here"},
      {"id":"2", "name":"James", "text":"Online"},
    ])
  });

How would I retrieve an entry say if I had “1” and I wanted to lookup using that “1” to retrieve the name/text for that entry (entry 1)?

  • 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-29T14:43:30+00:00Added an answer on May 29, 2026 at 2:43 pm

    Assuming that each defaultValue property will be an Array and not a JSON string – you should iterate through the settingDefs array and return all (or maybe just the first?) entry in the defaultValue property whose id matches the one you have. Something like this:

    function lookupValueById(sds, id) {
      for (var i=0; i<sds.length; i++) {
        for (var j=0; j<sds[i].defaultValue.length; j++) {
          var el = sds[i].defaultValue[j];
          if (el.id == id) return el;
        }
      }
      return null;
    }
    lookupValueById(settingDefs, 1); // => {id:'1', name:'Bob', text:'Is Here'}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to process JSON files that looks like this: \u0432\u043b\u0430\u0434\u043e\u043c <b>\u043f\u0443\u0442\u0438\u043c<\/b> \u043d\u0430\u0447 Unfortunately,
I have a JSON data like this: { hello: { first:firstvalue, second:secondvalue }, hello2:
I have a column model like that: ... {name:'password',index:'password', width:100}, {name:'type.name',index:'type.name', width:100}, ... My
I have a JSON array like this: { forum:[ { id:1, created:2010-03-19 , updated:2010-03-19
I have some JSON returned to the browser like this product: { Title: School
I have a JSON result that contains numerous records. I'd like to show the
I have an external JSON file (data.json) and would like to get data from
I have a JS object that look something like this. function Product() { this.prop1
I have an array of json objects like so: [{a:b},{c:d},{e:f}] What is the best
If you have a controller method like so: @expose(json) def artists(self, action=view,artist_id=None): artists=session.query(model.Artist).all() return

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.