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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:35:51+00:00 2026-06-07T09:35:51+00:00

I am trying to store the values inside a javascript object notation. I have

  • 0

I am trying to store the values inside a javascript object notation. I have done a bit of programing and got to store all the occureneces in to a string separated with commas, Bt if the term Im trying to find is an array, I get [object object] in return, as it is an array. I want to know how I can store all the items in that array in to a variable separated by commas, here for example if I select “Time”, then it should return Dec 9, 1, 2012

The part Ive reached returns the value if its a non array, http://jsbin.com/obehog/3/edit

and the depth of the arrays could change, it wont be the same in each case. so going through loop will not work..

  • 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-07T09:35:54+00:00Added an answer on June 7, 2026 at 9:35 am

    if you select “Time”, the result is an array, like:

    [[{
        "term": "Dec 9",
        "Dec_9": [{
            "count": 1,
            "term": "2012"
        }]
    }]]
    

    if you want a result like Dec 9, 1, 2012, you need a method to parse an object to string (or string array), code like:

    function valuesOfObj(obj, result) {
        result = result || [];
        if (typeof obj === 'object') {
            for (var k in obj) {
                if (obj.hasOwnProperty(k)) {
                    arguments.callee(obj[k], result);
                }
            }
        } else {
            result.push(obj);
        }
        return result;
    }
    
    console.log(valuesOfObj([{
        "term": "Dec 9",
        "Dec_9": [{
            "count": 1,
            "term": "2012"
        }]
    }]).join(', ')); // -> Dec 9, 1, 2012
    

    the full demo

    By the way, what you done is excellent, there are some other achieve like jsonselect and JSONQuery, Hope useful for you.

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

Sidebar

Related Questions

I'm trying to initialise some data values dynamically inside a javascript object, but when
I am trying to store values in array using JavaScript, but I get strange
I am trying to store a noncopyable (but movable) object inside an std::pair, as
I am trying to convert Javascript object to CSV and store it in to
I am trying to store values from an array, to a hash (array value
so I'm trying to store values in an array of Lists in C# winForms.
I am trying to store different values into an array based on a number
I'm trying to store multiple values for a key in a data structure so
I am trying to store a set of values in delphi, but i want
I'm trying to create a 2D array to store some values that don't change

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.