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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:03:56+00:00 2026-06-11T11:03:56+00:00

Have the following code: String s= v.request(engine/?key=, P4z72NmBa91&method=load); JSONParser parser = new JSONParser(); Object

  • 0

Have the following code:

String s= v.request("engine/?key=", "P4z72NmBa91&method=load");
JSONParser parser = new JSONParser();
Object obj = parser.parse(s);
JSONArray arr = (JSONArray)obj;
System.out.println(arr);

Which outputs:

[
    {"time":"2012-09-10 19:09:08",
     "username":"SomeUsername",
     "times_logged":"1",
      "ip":"33.33.33.33"
     }
]

Sorry if the above is not formatted correctly.

Anyway, there are multiple sets of these in arr, and when I do arr.get(0) it returns the first one, as expected. What isn’t working right is I can’t do arr.get(0).get(1) or arr.get(0).get("time") or anything like that. I’ve tried to set it up like this:

    for(int i = 0; i < arr.size(); i++) {
        JSONArray p = (JSONArray)arr.get(i);
        System.out.println(p.get(0));
    }

, and I get the error mentioned in the title of my question. Although I believe that arr isn’t a JSONArray, but a JSONObject? If that is the case, how can I iterate through off things contained in arr and get each item?

  • 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-11T11:03:57+00:00Added an answer on June 11, 2026 at 11:03 am
     for(int i = 0; i < arr.size(); i++) {
            JsonObject p = (JsonObject)arr.get(i);
            System.out.println(p.get("time").getAsString());
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code string three() { return three; } void mutate(string& ref)
I have the following code: Dim lStatementText As String Dim lStatementString As New System.Text.StringBuilder
I have the following type of code: String strGroup = Request.QueryString[group]; switch(strGroup.ToString){ case Clients:
I have the following code: string ip = Request.ServerVariables[REMOTE_ADDR]; Which, in the test environment
I have the following code Case "Formula_MDX" Dim cubeid As String = Request("intCubeId") Dim
I have the following code throws exception (absolute path required): string versionIdStr = HttpContext.Current.Request[xxx];
I have the following code in JS: new Ajax.Request('http://www.some_random_url.com', { parameters: { start :
I have the following code: var request = new GeocodingRequest(); request.Address = postcode; request.Sensor
Getting the following error: The method request(String, Bundle, AsyncFacebookRunner.RequestListener, Object) in the type AsyncFacebookRunner
I have the following code: String website = http://www.somewebsite.com/; Document doc = Jsoup.connect(website).get(); Elements

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.