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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:01:33+00:00 2026-06-08T05:01:33+00:00

Given json like this : { rss: { page: 1, results: [{ type: text,

  • 0

Given json like this :

{ "rss": {
   "page": 1,
   "results": [{
      "type": "text",
      "$": 10
   }],
   "text": [{
      "content": "Lorem ipsum dolor sit amet.",
      "author": {
         "name": "Cesar",
         "email": "cesar@evoria.com"
      },
   },
   {
      "content": "Tema Tis rolod muspi merol.",
      "author": {
         "name": "Cleopatre",
         "email": "cleopatre@pyramid.com"
      },
   }]
}

In javascript, I can retrieve value like this :

var json = JSON.parse(datajson);
$.each(json.text, function(key, val) {
    // this one is ok
    var content = val['content'];
    // this one does not work
    var authorname = val['author.name'];
});

Is this a way, given the attribute name in a string format, to retrieve the value of a complex object, for instance json.text[0].author.name?

EDIT
I would like to store the needed attributes in another object like :

[
    { dt: "Text content", dd: "content" },
    { dt: "Author name", dd: "author.name"}
]
  • 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-08T05:01:34+00:00Added an answer on June 8, 2026 at 5:01 am

    You can split your “index” by . and loop over “segments”, descending through levels on each iteration.

    var obj = {
       author : {
          name : "AuthorName"
       }
    }
    
    function get_deep_index(obj, index) {   
       var segments = index.split('.')
       var segments_len = segments.length
       var currently_at = obj
       for(var idx = 0; idx < segments_len; idx++) {
          currently_at = currently_at[segments[idx]]
       }
       return currently_at
    }
    
    console.log(get_deep_index(obj, 'author.name'))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given some code like this: class Json { } class Program { static void
Given json like this: [ [Rating (out of 5), 3], [Date taken, Mon, 03
Given a JSON string like this: {Locations: {list: [ {description: some description, name: the
Given this method to work on a HTML page in a webbrowser: bool semaphoreForDocCompletedEvent;
Is it even possible to do something like this with just text, HTML and
I have this json object- it's abbreviated, but it looks somewhat like the following
I cannot access my JSON object properties. Given this constructor contractorTestQuestion = function (id,
I have json that looks like the following although this is only the beginning
Given the following JSON data: [ { pk: 2, model: corkboard.announcement, fields: { body:
i need to parse the JSON data given below. {result:[{bookId:142645,bookpb:MF, bookTs:1328999630000,clipStatus:D,bookDetail:{arrival:1,purchase:1,sold:1}, hierarchies:{categories:[4],events:[]},shopId:769752}, upto sold

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.