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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:19:40+00:00 2026-06-19T00:19:40+00:00

I have read JSON data from a URL as a string object and passed

  • 0

I have read JSON data from a URL as a string object and passed it (as a string object) to my second activity. How can I read values from this string object? Please help me.

Below is my json:

{
    "speciality": [
        {
            "id": "1",
            "d_name": "Dr.Steven Cohen",
            "file_upload": "dr-photo.png",
            "d_address": "3838 California St. San Francisco,CA 94118",
            "d_specialty": "Eye",
            "designation": "Ophthalmologist",
            "d_city": "San Francisco",
            "d_state": "Calfornia",
            "d_zipcode": "CA94118",
            "d_phone": "018  000  000",
            "latitude": "18.815427",
            "longitude": "76.775144"
        },
        {
            "id": "2",
            "d_name": "Dr.  Hanish Patel",
            "file_upload": "hanish-patel.jpg",
            "d_address": " 160  East 56th Street New York, NY 10022 ",
            "d_specialty": "Eye",
            "designation": "Optometrist",
            "d_city": "New York",
            "d_state": "United States",
            "d_zipcode": "NY 10022",
            "d_phone": "018 000 000",
            "latitude": "40.760407",
            "longitude": "-73.968694"
        },
        {
            "id": "3",
            "d_name": " Dr. Leonard Bley MD, FACS ",
            "file_upload": "leonard-bley.jpg",
            "d_address": " 160 East 56th Street New York, NY 10022",
            "d_specialty": "Eye",
            "designation": "Ophthalmologist",
            "d_city": "New York",
            "d_state": "United States",
            "d_zipcode": "NY 10022",
            "d_phone": "018 000 000",
            "latitude": "40.760407",
            "longitude": "-73.968694"
        },
        {
            "id": "4",
            "d_name": "Dr. John Selle",
            "file_upload": "john_selle.jpg",
            "d_address": "2250 Hayes St Ste 206 San Francisco, CA 94117",
            "d_specialty": "Eye",
            "designation": "General  Practitioner",
            "d_city": "San Francisco",
            "d_state": "Calfornia",
            "d_zipcode": "CA94118",
            "d_phone": "018 000 000",
            "latitude": "37.78604",
            "longitude": "-122.457639"
        }
    ]
}

And here is my code:

try {
    JSONObject mainObject = new JSONObject(strjson);
    //JSONObject uniObject =         mainObject.getJSONObject("speciality");
    //JSONObject  uniName = uniObject.getJSONObject("d_name");
    //JSONObject uniURL = uniObject.getJSONObject("d_address");

    JSONObject oneObject = mainObject.getJSONObject("d_name");

    Log.e("name:", "unique name" + oneObject);
} catch (JSONException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}

}

  • 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-19T00:19:41+00:00Added an answer on June 19, 2026 at 12:19 am

    Try this ….

          JSONObject mainObject = new JSONObject(strjson);
    
          JSONArray Array = mainObject.getJSONArray("speciality");
            for (int j = 0; j < Array.length(); j++) 
            {   
                if (Array.getJSONObject(j).has("id")) 
                {
                    String str1 = (Array.getJSONObject(j).getString("id"));
                    String str2 = (Array.getJSONObject(j).getString("d_name"));
                  Log.e("TA","name:"+str2);
                 }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code like this to show data from mysql, its to read data
I have a store that read json string from .Net Server. The problem is
I am using WebRequest to read JSON data from the FCC so I can
Im trying to get my javascript to read the JSON from a url on
I have a 'simple' scenario: Read some JSON file, Filter or change some of
I have read a bunch of forums on this but none have solved my
Well I have a problem reading the JSON data in jQuery, which is outputted
I have an iPhone app which is pulling just about all it's data from
I have an ExtJS store with an ajax proxy and json reader: Ext.create('Ext.data.Store', {
I have been staring at this for a while and can't seem to figure

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.