-2

I want to parse this JSON in API call Method.

{
  "Name": "sample string 1",
  "About": "sample string 2",
  "ImageUrl": "sample string 3",
  "StartDate": "2016-09-21T13:07:25.4074934+00:00",
  "IsPrivate": true,
  "InvitedUser": [
    {
      "Id": 1,
      "Name": "sample string 2",
      "PhoneNumber": "sample string 3"
    },
    {
      "Id": 1,
      "Name": "sample string 2",
      "PhoneNumber": "sample string 3"
    }
  ]
}
989
  • 12,579
  • 5
  • 31
  • 53
Mohsin Qureshi
  • 1,203
  • 2
  • 16
  • 26

1 Answers1

-1
func jsonParsing()
    {
        let path: NSString = NSBundle.mainBundle().pathForResource("jsondata", ofType: "json")!
        let data : NSData = try! NSData(contentsOfFile: path as String, options: NSDataReadingOptions.DataReadingMapped)

let dict: NSDictionary!=(try! NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers)) as! NSDictionary

    dataDict = dict.valueForKey("main") as! NSDictionary

      print("json data : ", dataDict)

      self.tableview.reloadData()


}
989
  • 12,579
  • 5
  • 31
  • 53
sanjana
  • 220
  • 1
  • 15