title: Saving NSDictionary from json result to NSUserDefaults return "attempt to insert non-property list object" error
body: <p>hello i have json data like this</p>
  
  <p>result from NSLog(@"JSON sec blnce list: %@", responseObject);:</p>
  
  <pre><code>{
  detail =     (
              {
          account = 9X000101300160;
          balance = "1.000.000";
          date = "&lt;null&gt;";
          price = 0;
          secCode = 9999;
          type = Blocked;
          value = 0;
      },
              {
          account = 9X000101300160;
          balance = "1.000.000";
          date = "&lt;null&gt;";
          price = 0;
          secCode = 9999;
          type = Available;
          value = 0;
      }
  );
  header =     {
      date = 24092012;
      investorID = IDD010239865303;
      securityType = Equity;
  };
  }
  </code></pre>
  
  <p>what i want to do is saving this json result into NSUserDefaults. Here is how i save:
  in .h</p>
  
  <pre><code>@property NSDictionary *jsonResult;
  </code></pre>
  
  <p>in .m</p>
  
  <pre><code>AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
          [manager.requestSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
  
          [manager POST:URI_SECURITY_BALANCE_DETAIL parameters:param success:^(AFHTTPRequestOperation *operation, id responseObject) {
  
              [SVProgressHUD dismiss];
  
  
              NSLog(@"JSON sec blnce list: %@", responseObject);
  
              self.jsonResult = responseObject;
  
              //simpan hasil query ke device
              NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
              [defaults setObject:self.jsonResult forKey:@"securityBalanceNextJsonResult"];
              [defaults synchronize];
  </code></pre>
  
  <p>but above code give me an error: "Attempt to set a non-property-list object"</p>
  
  <p>how i save NSDictionary that i got from json result into NSUserDefaults??</p>
  
  <p>update:(solved)
  may be someone have the same problems, here is how my working code:</p>
  
  <pre><code>self.jsonResult = responseObject;
  
          NSData *data = [NSJSONSerialization dataWithJSONObject:self.jsonResult options:kNilOptions error:nil];
          [[NSUserDefaults standardUserDefaults] setObject:data forKey:@"securitiesBalanceJsonResult"];
  
          NSError* error;
          NSDictionary* jsonDB = [NSJSONSerialization
                                JSONObjectWithData:[defaults objectForKey:@"securitiesBalanceJsonResult"]
  
                                options:kNilOptions 
                                error:&amp;error];
  
          NSLog(@"data:%@",jsonDB);
  </code></pre>