title: Data type issues with CRM OData/REST calls (JSON)
body: <p>I'm trying to clone records in CRM using javascript. I'm following the code similar to this article ----
  <strong><a href="http://thinkingincrm.blogspot.in/2013/07/clone-record-via-javascript-crm-2011.html" rel="nofollow">clone records</a>.</strong> </p>
  
  <p>I get the following error where there are 'boolean' type fields in the record. Can someone please suggest how to parse/modify the data to get rid of this error? </p>
  
  <p>Incorrect attribute value type <strong>System.Data.Services.Serializers.JsonReader+JsonObjectRecords</strong></p>
  
  <p>When I debug the code the value for the boolean attribute is coming as <strong>true</strong> or <strong>false</strong> and i'm passing it as is (no formatting). </p>
  
  <p>I have tried replacing the boolean value with value.toString() or even new Boolean(value) and it didn't work. </p>
  
  <hr>
  
  <p>LOG: </p>
  
  <pre><code>{
     "__metadata":{
        "uri":"http:///POC /XRMServices/2011/OrganizationData.svc/okn_dealSet(guid'b0ede4ab-15c9-e311-94e1-00155d000854')",
        "type":"Microsoft.Crm.Sdk.Data.Services.okn_deal"
     },
     "okn_name":"Go boolean",
     "new_allowemail":true,
     "TimeZoneRuleVersionNumber":0,
     "OwningBusinessUnit":{
        "__metadata":{
           "type":"Microsoft.Crm.Sdk.Data.Services.EntityReference"
        },
        "Id":"b229bd07-d2be-e311-b028-00155d000854",
        "LogicalName":"businessunit",
        "Name":null
     },
     "UTCConversionTimeZoneCode":null,
     "OwningUser":{
        "__metadata":{
           "type":"Microsoft.Crm.Sdk.Data.Services.EntityReference"
        },
        "Id":"f8d8b780-a4a2-e311-b51b-00155d000854",
        "LogicalName":"systemuser",
        "Name":null
     },
     "OwningTeam":{
        "__metadata":{
           "type":"Microsoft.Crm.Sdk.Data.Services.EntityReference"
        },
        "Id":null,
        "LogicalName":null,
        "Name":null
     },
     "okn_type":{
        "__metadata":{
           "type":"Microsoft.Crm.Sdk.Data.Services.OptionSetValue"
        },
        "Value":200000001
     }
  }
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>I have also encountered the same issue when i used the date formatting function from <a href="http://msdn.microsoft.com/en-us/library/gg309549.aspx" rel="nofollow"><strong>SDK</strong></a>. The date value was coming like this : 
      "okn_startdate":{}, </p>
  
  <pre><code>_dateReviver: function (key, value) {
   ///&lt;summary&gt;
    /// Private function to convert matching string values to Date objects.
    ///&lt;/summary&gt;
    ///&lt;param name="key" type="String"&gt;
    /// The key used to identify the object property
    ///&lt;/param&gt;
    ///&lt;param name="value" type="String"&gt;
    /// The string value representing a date
    ///&lt;/param&gt;
    var a;
    if (typeof value === 'string') {
     a = /Date\(([-+]?\d+)\)/.exec(value);
     if (a) {
      return new Date(parseInt(value.replace("/Date(", "").replace(")/", ""), 10));
     }
    }
    return value;
   },
  </code></pre>