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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:24:54+00:00 2026-06-14T08:24:54+00:00

i create one small apps with json parsing in that i am accessing json

  • 0

i create one small apps with json parsing in that i am accessing json array but in this jsonarray i want phonenumbers title and addressline but how to access phone numbers
ican’t understand so how to access it

here is json format

> {
    "responseData": {
        "results": [
            {
              "title": "Pakvan Dining Hall",
              "phoneNumbers": [
                    {
                        "type": "",
                        "number": "079 26636473"
                    },
                    {
                        "type": "Mobile",
                        "number": "09427608429"
                    }
                ],
                 "addressLines": [
                    "Vadilal Sarabhai Hospital",
                    "Ahmedabad, Gujarat 380006, India"
                ]
            },
            {
              "title": " Dining Hall",
              "phoneNumbers": [
                    {
                        "type": "",
                        "number": "079 26645473"
                    },
                    {
                        "type": "Mobile",
                        "number": "09427608429"
                    },
                    {
                        "type": "",
                        "number": "079 26645473"
                    },
                    {
                        "type": "Mobile",
                        "number": "09427608429"
                    }
                ],
                 "addressLines": [
                    " Sarabhai Hospital",
                    "Ahmedabad, Gujarat 380006, India"
                ]
            },
}

ArrayList> contactList = new ArrayList>();

    JsonParser jparser= new JsonParser();
    String jsonstringfunction =jparser.jsonstringfunction(url);

    Log.e("Jsonstringfunction","n"+jsonstringfunction);

    try
    {   
        JSONObject jsonObject2 = new JSONObject(jsonstringfunction);

        JSONObject response = jsonObject2.getJSONObject(TAG_RESPONSE);
        JSONArray jresults=response.getJSONArray(TAG_RESULTS);
        Log.e("check","3333"+jresults);

        for (int i = 0; i < jresults.length(); i++)
        {
            Log.e("check","4444"+jresults.length());
            String titlenoformating = jresults.getJSONObject(i).get(TAG_TITLENOFORMATING).toString();

            Log.e("Title",""+titlenoformating);

            HashMap<String, String> map = new HashMap<String, String>();
            map.put(TAG_TITLENOFORMATING,titlenoformating);

            JSONArray jaddressline=jresults.getJSONObject(i).getJSONArray(TAG_ADDRESSLINES);

            Log.e("addressline","addressline"+jaddressline);
            String addressline2="";
            for(int j=0;j<jaddressline.length();j++)
            {   
                addressline2=addressline2+jaddressline.getString(j).toString();

                Log.e("addressline","jaddressline"+addressline2);
            }
            // adding each child node to HashMap key => value
            map.put(TAG_ADDRESSLINES,addressline2); 

            JSONArray jphonenumbers=jresults.getJSONObject(i).getJSONArray(TAG_PHONENUMBERS);

            for(int k=0;k<jphonenumbers.length();k++)
            {

                Log.e("Phonenumbers","phonenumbers"+jphonenumbers);

             JSONArray jtype=jphonenumbers.getJSONObject(k).getJSONArray(TAG_TYPE);

                Log.e("JsonPhone","type"+jtype);
                for(int m=0;m<jtype.length();m++)
                {                   

                    String type=jtype.getString(m).toString();

                    Log.e("type","type"+type);
                }       

            }


            contactList.add(map);
        }
  • 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-14T08:24:55+00:00Added an answer on June 14, 2026 at 8:24 am
    String[] title,number,address;
    JSONObject jobject = new JSONObject(your_result_object);
    JSONObject json=jobject;
    JSONObject jresponse = json.getJSONObject("responseData");
    JSONArray jresult = jresponse.getJSONArray("results");
    
    title = new String[jresult.length()];
    
    for(int i=0;i<jresult.length();i++){
    JSONObject obj = jresult.getJSONObject(i);
    title[i] = obj.getString("title");
    
    JSONArray jphonenumbers = obj.getJSONArray("phoneNumbers");
    number = new String[jphonenumbers.length()];
    
    for(int j=0;j<jphonenumbers.length();j++){
    JSONObject obj2 = jphonenumbers.getJSONObject(j);
    number[j] = obj2.getString("number");
    }
    
    JSONArray jaddress = obj.getJSONArray("addressLines");
    address = new String[jaddress.length()];
    for(int k=0;k<jaddress.length();k++){
    address[k] = jaddress.getString(k);
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create one proc like below but it has error on syntax.
I want to create one new model class, which will be extended in all
Basically I want to create one large object of many object in JavaScript. Something
How can I create one of these small red round delete buttons like in
I have samsung galaxy s2 and I want to create a small app to
I want to use Lucene.NET for fulltext search shared between two apps: one is
If i create a program, which in one small out of the way area,
I want to create a regex, where the occurence of one group, depends on
I am developing a small web application application. The objective is to create one
I'm working on an iOS app that will create a lot of small objects

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.