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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:03:36+00:00 2026-05-26T02:03:36+00:00

I am in a bit of a fix regarding the JSONObject that I am

  • 0

I am in a bit of a fix regarding the JSONObject that I am getting as a response from the server.

jsonObj = new JSONObject(resultString);
            JSONObject sync_reponse = jsonObj.getJSONObject("syncresponse");
            String synckey_string = sync_reponse.getString("synckey");
            JSONArray createdtrs_array = sync_reponse.getJSONArray("createdtrs");
            JSONArray modtrs_array = sync_reponse.getJSONArray("modtrs");
            JSONArray deletedtrs_array = sync_reponse.getJSONArray("deletedtrs");
            String deleted_string = deletedtrs_array.toString();

{"syncresponse":{"synckey":"2011-09-30 14:52:00","createdtrs":[],"modtrs":[],"deletedtrs":[{"companyid":"UTB17","username":"DA","date":"2011-09-26","reportid":"31341"}]

as you can see in the response that I am getting I am parsing the JSONObject and creating syncresponse, synckey as a JSON object createdtrs, modtrs, deletedtrs as a JSONArray. I want to access the JSONObject from deletedtrs, so that I can split them apart and use the values. i.e I want to extract companyid, username, date etc.

How can I go about this ?

Thanks for your input.

  • 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-26T02:03:36+00:00Added an answer on May 26, 2026 at 2:03 am

    JSONArray objects have a function getJSONObject(int index), you can loop through all of the JSONObjects by writing a simple for-loop:

    JSONArray array;
    for(int n = 0; n < array.length(); n++)
    {
        JSONObject object = array.getJSONObject(n);
        // do some stuff....
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a sources of existing portlet. I changed it a bit to fix
I'm in a bit of a fix here. An app searches Core Data and
Bit support question. Apologies for that. I have an application linked with GNU readline.
I noticed that fckeditor tries to fix bad html syntax. I was wondering if
i am trying to fix a bit of broken code here. basically its a
I recently added a tiny bit of jquery to a website to fix a
I have a series of warnings that I'm trying to fix when building gdcm
I don't know the slightest bit of Perl and have to fix a bug
question is bit different than other questions regarding this. I had a similar issue
I wanted to get my concepts a bit clearer regarding the malloc() call in

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.