-1

How do I Parse this

{
"district": [
    {
        "1": {
            "name": "Lucknow",
            "block": [
                {
                    "1": "Block1",
                    "2": "Block2",
                    "3": "Block3"
                }
            ]
        }
    },
    {
        "2": {
            "name": "Kanpur",
            "block": [
                {
                    "1": "Block1",
                    "2": "Block2",
                    "3": "Block"
                }
            ]
        }
    }
]
}

I am stuck at this help me & pick me out of this, also suggest some link for jSON parsing, So that I can learn

chinmayan
  • 1,304
  • 14
  • 13
Prateek Gupta
  • 148
  • 11

1 Answers1

0

You might want to verify if the JSON returned from the API is proper. The proper JSON response should look something like below. This is just my assumption since parsing dynamic keys would be a problem.

{
    "district":[
        {
            "name":"Lucknow",
            "block":[
                "Block1",
                "Block2",
                "Block3"
            ]
       },
       {
            "name":"Kanpur",
            "block":[
                "Block1",
                "Block2",
                "Block"
            ]
        }
    ]
}
miteshpithadiya
  • 214
  • 1
  • 10