title: How can I do a "deep compare" or "diff" on two Structs?
body: <p>(This is a coldfusion question)</p>
  
  <p>I've got two different Structs that may or may not contain the same data, and I want to be able to see if they do! My Structs will always contain simple values (Numbers, Strings or Booleans) because they are being created with DeserializeJSON, so hopefully this can be done easily.</p>
  
  <p>I found Ben Nadel's post <a href="http://www.bennadel.com/blog/210-Comparing-ColdFusion-Struct-Equality-With-Java.htm" rel="nofollow noreferrer">here</a>, but that technique doesn't seem to working for me. Here is what I've tried so far (some cfwheels code in there):</p>
  
  <pre><code>itemA = DeSerializeJSON(model("itemsnapshot").findByKey(4).json);
  itemB = DeSerializeJSON(model("itemsnapshot").findByKey(5).json);
  
  StructDelete(itemA,"updatedAt");
  StructDelete(itemB,"updatedAt");
  StructDelete(itemA,"createdAt");
  StructDelete(itemB,"createdAt");
  
  writedump(itemA);
  writedump(itemB);
  
  out = itemA.Equals(itemB);
  writedump(out);
  </code></pre>
  
  <p>And the results of that look like:</p>
  
  <pre><code>Struct
  code string C112
  companyid number 1
  cost number 5000
  deletedAt string 
  description string Nightstand
  id number 70634
  itemtypeid string 13
  projectid number 8
  unittypeid string
  
  Struct
  code string C112
  companyid number 1
  cost number 5000
  deletedAt string 
  description string Nightstand
  id number 70634
  itemtypeid string 13
  projectid number 8
  unittypeid string 
  
  boolean false
  </code></pre>
  
  <p>so, as you'll see above, although the data inside the Structs appear to match exactly they do not pass the Equals() test.</p>
  
  <p>Has anyone else done this successfully?</p>