-7

How to parse JSON which consist of array of array objects?

Here is my JSON string:

I want to parse Delhi,uttar pradesh,south mumbai,karnataka,test in one array and then llly central delhi,Ghaziabad.. to another set of array?

{
  "Result": "Success",
  "RegionList": [
    {
      "Delhi": {
        "Central Delhi": [
          "Dwarka Nagar"
        ]
      },
      "Uttar Pradesh": {
        "Ghaziabad": [
          "Kalka Garhi Chowk"
        ]
      },
      "South Mumbai": {
        "Mumbai": [
          "Navi Mumbai"
        ]
      },
      "Karnataka": {
        "bangalore": [
          "Silk board"
        ]
      },
      "test": {
        "test": [
          "testtyt"
        ]
      }
    }
  ]
}
3
  • i just want to parse this json output Commented Oct 20, 2015 at 10:52
  • could you post on what you have tried and where you are facing problem... Commented Oct 20, 2015 at 10:59
  • what is the issue faced Commented Oct 20, 2015 at 11:08

1 Answer 1

3

You should use

NSJSONSerialization

It will automatically take care of parsing and will return you a dictionary of array objects. The objects within the Dictionary can be accessed using key value pair.

NSDictionary* json = [NSJSONSerialization
                      JSONObjectWithData:yourjsonData
                      options:kNilOptions
                      error:&error];
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.