-5

This is the JSON string:

      { 
         enter code {
          "status":101,
          "message":"Success",
          "result":{
            "society_name":"Sai Smruti",
            "society_id":"a882a29c-8305-b199-5d90-57bbd03aae0e",
            "wings":{
              "44c07cc9-d967-776c-9461-57bbd07e1c8f":{
                "wing_id":"44c07cc9-d967-776c-9461-57bbd07e1c8f",
                "wing_name":"A",
                "level":{
                  "1":{
                    "flat":[
                      {
                        "flat_id":"9fc0ffb2-342c-2a6c-91f9-57bbd0462896",
                        "flat_name":"101"
                      }
                    ]
                  },
                  "2":{
                    "flat":[
                      {
                        "flat_id":"96789d3f-59b9-d30f-febc-57bbd0754f40",
                        "flat_name":"201"
                      }
                    ]
                  }
                }
              },
              "b1d10baf-412a-ebc0-06ef-57bbd0f0cd0f":{
                "wing_id":"b1d10baf-412a-ebc0-06ef-57bbd0f0cd0f",
                "wing_name":"B",
                "level":{
                  "1":{
                    "flat":[
                      {
                        "flat_id":"a7f92b35-bb1c-2dd3-a9d7-57bbd0acbd2e",
                        "flat_name":"101"
                      }
                    ]
                  },
                  "2":{
                    "flat":[
                      {
                        "flat_id":"1044aea0-83d5-4948-5cec-57bbd01cd4f2",
                        "flat_name":"202"
                      }
                    ]
                  }
                }
              },
              "24736fc9-ecf7-8edf-a4bc-57bbd0154ada":{
                "wing_id":"24736fc9-ecf7-8edf-a4bc-57bbd0154ada",
                "wing_name":"C",
                "level":{
                  "3":{
                    "flat":[
                      {
                        "flat_id":"988e3884-f53d-a57e-0877-57bbd1c58e25",
                        "flat_name":"303"
                      }
                    ]
                  }
                }
              }
            },
            "row_house":[
              {
                "row_house_id":"b2d1cd2e-1440-3937-bc22-57bbd0d5e1cf",
                "row_house_name":"Komal"
              },
              {
                "row_house_id":"8f28ed50-0717-44c7-8cfd-57bbd0ab9f54",
                "row_house_name":"Nishant"
              }
            ]
          }
        }
Burhanuddin Rashid
  • 5,260
  • 6
  • 34
  • 51
  • ... as any other json ... – Selvin Aug 23 '16 at 12:11
  • 3
    Possible duplicate of [How to parse JSON in Java](http://stackoverflow.com/questions/2591098/how-to-parse-json-in-java) – Selvin Aug 23 '16 at 12:12
  • please install GSON plugin on android studio and pass your json.It automatically create your pojo class – Saveen Aug 23 '16 at 12:17
  • Check the followings will help you: http://stackoverflow.com/questions/8091051/how-to-parse-json-string-in-android http://stackoverflow.com/questions/6773474/json-parsing-to-java-android-application – Mahmoud Ibrahim Aug 23 '16 at 12:18

1 Answers1

0

You can use some kind of lib like Gson, and deserialize it using a Class as:

public class Response {
   private int status;
   private String message;
  ...
}

For the embedded "result" object, you need to create another class with the fields of this object (societyName, societyId)...

You can find more doc here

pianista
  • 108
  • 8