In the success section of my ajax call I'm able to set variables based on the index of the raw json that's returned from my WCF RIA service like this:

Code:
                var results = data.GetCorrespondenceByIDResult;
                var correspondence = results.RootResults[0];
                var contact = results.IncludedResults[0];
                var letter = results.IncludedResults[1];
The problem I run into is that sometimes I have additional objects returned (The organization for the contact via a go between table called contactorganization) that throws off the index of the letter variable.

When looking at the results returned from the service I'm able to see that each of the items has is denoted as a stongly typed object in the form of

"__type":"Letter:#CRM.Data.Models"
Rather than get the results by index how can I look for the type and assign the variables based on that?