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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:24:00+00:00 2026-05-23T22:24:00+00:00

my json: [ { all: { dates: [ { date: 2011-01-18, name: asd },

  • 0

my json:

[
    {
        "all": {
            "dates": [
                {
                    "date": "2011-01-18",
                    "name": "asd"
                },
                {
                    "date": "2011-02-19",
                    "name": "ddd"
                },
                {
                    "date": "2011-11-21",
                    "name": "eee"
                }
            ],
            "dep": [
                {
                    "code": "BBB",
                    "name": "BUD"
                }
            ],
            "citys": [
                {
                    "id": "2163",
                    "name": "ASD"
                },
                {
                    "id": "2369",
                    "name": "EFG"
                },

...

my code

                JSONArray json = new JSONArray(s); //json string
                for(int i=0;i<json.length();i++){
                    String settings         = json.getJSONObject(i).getString("all");
                    JSONArray jsonarray     = new JSONArray(settings);

                    for (int j=0; j<jsonarray.length();j++){

                        String dates            = jsonarray.getJSONObject(j).getString("dates");
                        JSONArray jsonarray2    = new JSONArray(dates);

                        for (int k=0; k<jsonarray2.length();k++){
                            String date         =    jsonarray2.getJSONObject(k).getString("date");


                            Log.e("date", date);
                        }
..

.

07-19 09:52:31.356: ERROR/ex(19038): org.json.JSONException: Value
{“citys”:[{“id”:”2163″,”…

How can I parse this file correctly?

Thanks, Leslie

  • 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-23T22:24:02+00:00Added an answer on May 23, 2026 at 10:24 pm
    json.getJSONObject(i).getString("all");
    JSONArray jsonarray     = new JSONArray(settings);
    

    ‘all’ is a JSONObject, not a JSONArray, so get JSONObject and get JSONArrays dates,dep,citys.

    Can directly get json.getJSONObject(i).getJSONObject("all"); or getJSONObject from String,
    JSONObject jsonobj = new JSONObject(settings);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in an HTML page: alert(JSON.stringify(new Date())); I'm including the latest
hello all i have one json object like {event1:{title:My birthday,start:12\/27\/2011 10:20 ,end:12\/27\/2011 00:00 },event2:{title:My
Is there any reasons why PHP's json_encode function does not escape all JSON control
All of the data on my application is pulled through an API via JSON.
I've got some JSON data, but it's all on one line. Does anyone know
I'm buiding an HTML/jQuery site where almost all the content comes from remote JSON
My single-page javascript app retrieves data in JSON format via REST calls. Dates come
I have a JSON feed that I'm parsing. Here's the following code samples: JSON
I was making a function to convert all dates in an object to strings
Given the following JSON Date representation: \/Date(1221644506800-0700)\/ How do you deserialize this into it's

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.