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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:15:46+00:00 2026-05-22T22:15:46+00:00

Looking for org-json solutions only please ** Suppose you deal with a structure, as

  • 0

Looking for org-json solutions only please **

Suppose you deal with a structure, as follows.

Using json-org, how can i get an array of Tests, if this entire json is represented in a String s?

Using Google’s gson, it’s easy to do by testing what type given object is … i am missing something simple here with json-org libraries

{
   "Groups":{
      "Test":[
         {
            "Test Number":123456,
            "Channel":"TEST",
            "environment":"A",
            "output event":[
               {
                  "description":"very good description",
                  "value":123,
                  "active":true
               },
               {
                  "description":"another very good description",
                  "value":456,
                  "active":true
               }
            ],
            "active":true,
            "instrument":"ABC"
         },
         {
            "Test Number":547985,
            "Channel":"some new channel",
            "environment":"B",
            "output event":[
               {
                  "description":"reject",
                  "value":123,
                  "active":true
               },
               {
                  "description":"ack",
                  "value":456,
                  "active":true
               }
            ],
            "active":true,
            "instrument":"XYZ"
         }
      ],
      "name":"A clever name",
      "active":true
   }
}
  • 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-22T22:15:47+00:00Added an answer on May 22, 2026 at 10:15 pm

    It so happens i got it before someone else had a chance to help. In case someone else has similar question, i am posting an answer below:

    JSONObject o = new JSONObject(s);
    
    JSONArray arrayOfTests = (JSONArray) ((JSONObject) o.get("Groups")).get("Test");
    
    for (int i = 0; i < arrayOfTests.length(); i++) {
        System.out.println(arrayOfTests.get(i));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking forward to write a ASP.NET website which is using JSON to interact
Can anyone recommend how to install and use wordpress.org GeSHi syntaxhighlighter? I'm looking for
I'm using json.org JSONObject. I've tried to serialize it to memcache and got the
I'm looking to display only certain states using Polymaps. I'm using the Unemployment graph
I'm using the following code to get a JSON string from a URL: public
I'm looking at http://akuma.kohsuke.org/ , but it's only for POSIX systems. I don't need
Im mainly looking at the EntityStatics ( http://www.hibernate.org/hib_docs/v3/api/org/hibernate/stat/EntityStatistics.html ). I can see a lot
I was looking at http://tldp.org/LDP/abs/html/why-shell.html and was struck by: When not to use shell
I have been looking at LESS ( http://lesscss.org/ ) which adds variables and macro
I was looking at the program at http://www0.us.ioccc.org/1988/westley.c , mentioned in another SO answer

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.