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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:38:42+00:00 2026-06-05T13:38:42+00:00

I am scrapping data from website. The data we are getting is in the

  • 0

I am scrapping data from website. The data we are getting is in the format of

[
[
    {
        "train": "South Coast train (CityRail) ",
        "depTime": "7:26pm",
        "depStation": "Albion Park Station ",
        "depPlatform": "1",
        "arrTime": "7:46pm",
        "arrStation": "Wollongong Station ",
        "arrPlatform": "1"
    },
    {
        "train": "South Coast train (CityRail) ",
        "depTime": "8:00pm",
        "depStation": "Wollongong Station ",
        "depPlatform": "1",
        "arrTime": "9:14pm",
        "arrStation": "Hurstville Station ",
        "arrPlatform": "3"
    },
    {
        "train": "Eastern Suburbs and Illawarra train (CityRail) ",
        "depTime": "9:20pm",
        "depStation": "Hurstville Station ",
        "depPlatform": "3",
        "arrTime": "9:24pm",
        "arrStation": "Kogarah Station ",
        "arrPlatform": "3"
    },
    {
        "train": "Eastern Suburbs and Illawarra train (CityRail) ",
        "depTime": "9:27pm",
        "depStation": "Kogarah Station ",
        "depPlatform": "4",
        "arrTime": "9:31pm",
        "arrStation": "Allawah Station ",
        "arrPlatform": "4"
    }
],
[
    {
        "train": "South Coast train (CityRail) ",
        "depTime": "7:26pm",
        "depStation": "Albion Park Station ",
        "depPlatform": "1",
        "arrTime": "7:46pm",
        "arrStation": "Wollongong Station ",
        "arrPlatform": "1"
    },
    {
        "train": "South Coast train (CityRail) ",
        "depTime": "8:00pm",
        "depStation": "Wollongong Station ",
        "depPlatform": "1",
        "arrTime": "9:14pm",
        "arrStation": "Hurstville Station ",
        "arrPlatform": "3"
    },
    {
        "train": "Eastern Suburbs and Illawarra train (CityRail) ",
        "depTime": "9:30pm",
        "depStation": "Hurstville Station ",
        "depPlatform": "3",
        "arrTime": "9:32pm",
        "arrStation": "Allawah Station ",
        "arrPlatform": "3"
    }
],
[
    {
        "train": "South Coast train (CityRail) ",
        "depTime": "8:16pm",
        "depStation": "Albion Park Station ",
        "depPlatform": "1",
        "arrTime": "8:38pm",
        "arrStation": "Wollongong Station ",
        "arrPlatform": "1"
    },
    {
        "train": "South Coast train (CityRail) ",
        "depTime": "8:54pm",
        "depStation": "Wollongong Station ",
        "depPlatform": "1",
        "arrTime": "10:14pm",
        "arrStation": "Hurstville Station ",
        "arrPlatform": "3"
    },
    {
        "train": "Eastern Suburbs and Illawarra train (CityRail) ",
        "depTime": "10:30pm",
        "depStation": "Hurstville Station ",
        "depPlatform": "3",
        "arrTime": "10:32pm",
        "arrStation": "Allawah Station ",
        "arrPlatform": "3"
    }
],
[
    {
        "train": "South Coast train (CityRail) ",
        "depTime": "9:23pm",
        "depStation": "Albion Park Station ",
        "depPlatform": "1",
        "arrTime": "9:45pm",
        "arrStation": "Wollongong Station ",
        "arrPlatform": "1"
    },
    {
        "train": "South Coast train (CityRail) ",
        "depTime": "9:54pm",
        "depStation": "Wollongong Station ",
        "depPlatform": "1",
        "arrTime": "11:14pm",
        "arrStation": "Hurstville Station ",
        "arrPlatform": "3"
    },
    {
        "train": "Eastern Suburbs and Illawarra train (CityRail) ",
        "depTime": "11:30pm",
        "depStation": "Hurstville Station ",
        "depPlatform": "3",
        "arrTime": "11:32pm",
        "arrStation": "Allawah Station ",
        "arrPlatform": "3"
    }
],
{
    "1": {
        "train": "Eastern Suburbs and Illawarra train (CityRail) ",
        "depTime": "5:09am+",
        "depStation": "Hurstville Station ",
        "depPlatform": "3",
        "arrTime": "5:11am+",
        "arrStation": "Allawah Station ",
        "arrPlatform": "3"
    }
}

]

when i am converting above data to Json format i am getting the following error

    06-11 18:36:40.584: V/Error(657): Error in parsing Innerorg.json.JSONException: Value {"1":{"depTime":"5:09am+","arrStation":"Allawah Station ","arrTime":"5:11am+","train":"Eastern Suburbs and Illawarra train (CityRail) ","arrPlatform":"3","depStation":"Hurstville Station ","depPlatform":"3"}} at 4 of type org.json.JSONObject cannot be converted to JSONArray

How to parse this type of json strings in Android. Any advice friends……..?

  • 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-05T13:38:45+00:00Added an answer on June 5, 2026 at 1:38 pm

    My string was like below

    {
    "result": "success",
    "countryCodeList": [
    {
    "countryName": "World Wide",
    "countryCode": "00"
    },
    {
    "countryName": "Korea, Republic of",
    "countryCode": "kr"
    },
    {
    "countryName": "United States",
    "countryCode": "us"
    },-
    {
    "countryName": "Japan",
    "countryCode": "jp"
    },
    {
    "countryName": "China",
    "countryCode": "cn"
    },
    {
    "countryName": "India",
    "countryCode": "in"
    }
    ]
    }
    

    i have done

    JSONObject json = new JSONObject(jsonstring);
    JSONArray nameArray = json.names();
    JSONArray valArray = json.toJSONArray(nameArray);
    
    JSONArray valArray1 = valArray.getJSONArray(1);
    
        valArray1.toString().replace("[", "");
                valArray1.toString().replace("]", "");
    
                int len = valArray1.length();
    
                for (int i = 0; i < valArray1.length(); i++) {
    
                    Country country = new Country();
                    JSONObject arr = valArray1.getJSONObject(i);
    
                    country.setCountryCode(arr.getString("countryCode"));
                    country.setCountryName(arr.getString("countryName"));
                    arrCountries.add(country);
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running a bunch of scripts that are scraping data from a website. For
I'm scraping some data from the frontpages of a list of website domains. Some
I have been using HTML Parser to scrapping data from websites and stripping html
Background : With a Python Script, I scraping data (html) from a Website and
I am scraping data from web site using my java application and want to
I'm scraping data from the web, and I have several processes of my scraper
I am new at shell scripting and I am trying to read data from
I have such files to parse (from scrapping) with Python: some HTML and JS
I am trying to post some data and get some data back from a
i have the following script i am using to scrap data from my uni

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.