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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:59:58+00:00 2026-06-14T23:59:58+00:00

Instead of accessing a deep object with a known dot notation, I want to

  • 0

Instead of accessing a deep object with a known dot notation, I want to do the opposite: build the dot notation string from the keys of the deep object.

So given the following JSON object:

{
  great:{
    grand:{
      parent:{
        child:1
      },
      parent2:1
    }
  }
}

I’d like to get the following array of paths:

[
  "great.grand.parent.child",
  "great.grand.parent2"
]

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-06-15T00:00:00+00:00Added an answer on June 15, 2026 at 12:00 am

    Try this. But I don’t know why you need this.

    function path(a) {
      var list = [];
      (function(o, r) {
        r = r || '';
        if (typeof o != 'object') {
          return true;
        }
        for (var c in o) {
          if (arguments.callee(o[c], r + "." + c)) {
            list.push(r.substring(1) + "." + c);
          }
        }
        return false;
      })(a);
      return list;
    }
    var a = {
      great:{
        grand:{
          parent:{
            child:1
          },
          parent2:1
        }
      }
    };
    console.log(JSON.stringify(path(a)));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are some .NET libraries which use methods for accessing object data instead of
When accessing a form or query string value from code-behind in ASP.NET, what are
I need to prevent someone from directly accessing a pdf, instead only allowing them
Instead of stepping when the user clicks somewhere on the qslider I want to
I am creating a web project and want it to be optimized. Instead of
What are the advantages of using an ESB instead of directly accessing a database
I am accessing data from an SQL Server database to my ASP.Net C# based
Using a getter/setter in the internal code of a class instead of accessing the
I have been testing out using delegates instead of reflection for some object sorting
Some people have reported issues with accessing, setting, or getting the right value from

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.