title: Converting JSON Data from NSData to NSDictionary
body: <p>I have a PHP service that returns me the following response in NSData format. After converting the same into NSString using:</p>
  
  <pre><code>NSString *html = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
  </code></pre>
  
  <p>I get the following:</p>
  
  <pre><code>[
      {
          "Emp_Name": "Krishna Mamidi",
          "Emp_Designation": "Driver",
          "Emp_Type": "Permanent",
          "Joining_Date": "05-MAR-2011",
          "Salary": 10000
      },
      {
          "Emp_Name": "Aditya Reddy",
          "Emp_Designation": "supervisor",
          "Emp_Type": "Permanent",
          "Joining_Date": "06-MAR-2011",
          "Salary": 9000
      },
      {
          "Emp_Name": "Rajiv krishna",
          "Emp_Designation": "director",
          "Emp_Type": "Permanent",
          "Joining_Date": "01-MAR-2011",
          "Salary": 100000
      }
  ]
  </code></pre>
  
  <p>The above is in correct JSON Format. </p>
  
  <p>Having received the NSData format of the above, I use the following to convert the same into JSON Dictionary:</p>
  
  <pre><code>NSError *error = nil;
  id jsonObject = [NSJSONSerialization
                   JSONObjectWithData:data
                   options:NSJSONWritingPrettyPrinted error:&amp;error];
  
  NSDictionary *deserializedDictionary = nil;
  
  if (jsonObject != nil &amp;&amp; error == nil)
  {
      if ([jsonObject isKindOfClass:[NSDictionary class]])
      {
          //Convert the NSData to NSDictionary in this final step
          deserializedDictionary = (NSDictionary *)jsonObject;
      }
  }
  </code></pre>
  
  <p>However the "deserializedDictionary" is always null or empty. Basically it never came inside the If Loop above.</p>
  
  <p>I have been trying to figure this out for a while and am not able to. Please help</p>