Nested Types

Feb 1, 2010 at 11:03 AM

Hi

After my JSON query, If have the results as follows:-

{
"d" : {
"__metadata": {
"uri": "http://localhost:49300/WebDataService1.svc/Relationship(1287519)", "type": "CMXModel.Relationship"
}, "RelationshipID": 1287519, "Name": "CMS Import", "Active": true, "DateEnded": null, "Notify": null, "Rank": null, "Salutation": null, "Floor": null, "JobTitle": null, "Department": null, "IsDefaultLocation": true, "BaseContactParent": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/Relationship(1287519)/BaseContactParent"
}
}, "BaseContactChild": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/Relationship(1287519)/BaseContactChild"
}
}, "BaseListMember": [
{
"__metadata": {
"uri": "http://localhost:49300/WebDataService1.svc/BaseListMember(1465491)", "type": "CMXModel.BaseListMember"
}, "BaseListMemberID": 1465491, "BaseContact": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/BaseListMember(1465491)/BaseContact"
}
}, "BaseList": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/BaseListMember(1465491)/BaseList"
}
}, "Relationship": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/BaseListMember(1465491)/Relationship"
}
}, "IBEXCategory": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/BaseListMember(1465491)/IBEXCategory"
}
}, "Employees": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/BaseListMember(1465491)/Employees"
}
}, "EventMemberStatus": {
"__metadata": {
"uri": "http://localhost:49300/WebDataService1.svc/EventMemberStatus(10)", "type": "CMXModel.EventMemberStatus"
}, "EventMemberStatusID": 10, "Name": "Pending", "Code": "PEN", "BaseListMember": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/EventMemberStatus(10)/BaseListMember"
}
}
}
}
], "JobCategory": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/Relationship(1287519)/JobCategory"
}
}, "RelationshipType": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/Relationship(1287519)/RelationshipType"
}
}, "Office": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/Relationship(1287519)/Office"
}
}, "BaseContactInfos": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/Relationship(1287519)/BaseContactInfos"
}
}, "Employee": {
"__deferred": {
"uri": "http://localhost:49300/WebDataService1.svc/Relationship(1287519)/Employee"
}
}
}
}

 

I have a Relationship a BaseListMember and an EventStatus JSON described objects.

Calling your Deserialize method only the relationship (top level) object gets created<font size="2">

 

</font>

 

Dim wr As HttpWebRequest = HttpWebRequest.Create("http://localhost:49300/WebDataService1.svc/Relationship(1287519)?$expand=BaseListMember/EventMemberStatus")"application/json"

<font size="2">

wr.Accept =

</font>

"application/json"

If wr.GetResponse().ContentLength > 0 Then

Dim sr = New System.IO.StreamReader(wr.GetResponse().GetResponseStream())

Dim r As ServiceReference1.Relationship = jsonserialiser.Deserialize(sr, GetType(ServiceReference1.Relationship))

End If

 

What am I doing wrong?

 

Thanks

 

Ken