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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:15:06+00:00 2026-06-09T05:15:06+00:00

This is my json … using javascript .. i want to output just the

  • 0

This is my json …
using javascript .. i want to output just the name of the root in this case services
then traverse through the individual elements in the array

{
    services: {
        46: {
            servicetypeid: "27",
            serviceid: "51",
            servicename: "Parking",
            description: "Parking Related Payments",
            optioncode: [],
            inputid: [],
            price: [],
            categoryidentifier: []
        },
        47: {
            servicetypeid: "27",
            serviceid: "52",
            servicename: "Markets",
            description: "Markets Related Payments",
            optioncode: [],
            inputid: [],
            price: [],
            categoryidentifier: []
        },
        48: {
            servicetypeid: "27",
            serviceid: "53",
            servicename: "PSV",
            description: "Public Service Vehicles",
            optioncode: [],
            inputid: [],
            price: [],
            categoryidentifier: []
        }
    }
}
  • 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-09T05:15:08+00:00Added an answer on June 9, 2026 at 5:15 am

    That’s not JSON format data, you can loop thru the object:
    To get the root key, you could do:

    var rootKey;
    for(var prop in tst) {
     console.log( prop ); //will give "services"
     rootKey = prop;
    }
    

    And to loop thru all the items:

    for( var key in tst[rootKey] ) {
      for( var key1 in tst[rootKey][key] ) {
        console.log( "key:" + key1 + " --- Value:"+ tst[rootKey][key][key1] );
     }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to parse this JSON string using Gson {name:name,type:[a,b,c]} is it possible? 1st
This php function returns a json encoded object to a javascript through ajax. I
I want to show this json url output in table over here which is
I want to parse this json using jquery and each with a loop. I
I have this json data: [ {ID:1,name:google,IP:69.5.33.22,active:true}, {ID:2,name:bing,IP:70.5.232.33,active:false} ] I want to get the
I want to change this json output to below style, Any ideas? My Code:
How to output this JSON element in correct order by it's value? var json
I have this JSON file { 1 : { name: John Doe, birthYear: 1990,
So i have this json I got from a previous query: {HUID:1,UIDS:1,2,3,name:home,type:page,cat_id:home} I print
So I have this JSON, which then my activity retrieves to a string: {popular:

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.