Quantcast
Channel: VBForums - WPF, WCF, WF
Viewing all articles
Browse latest Browse all 256

Problem Deserializing the jsonString

$
0
0
I have a question that requires a bird's eye view of this topic, since I am a newbie on WCF. I retrieved data from the database and serialized it into a valid json string. I set the service-side object properties using the <DataContract()> and the <Datamember()> tag as required. However when I tried to deserialized the json string I always get the Error: The data contract type '...' cannot be deserialized because the required data members '...' were not found. The string I used to deserialize is: [Dim strm As New MemoryStream(Encoding.UTF8.GetBytes(json))
Dim ser As New _
DataContractJsonSeriaalizer(ldsp.[GetType]())
ldsp = DirectCast(ser.ReadObject(strm), List (Of lds))]

Ldsp is: Dim ldsp as New List (Of lds)), where lds is a proxy object I.e. Client-side object, whicj has a <Serializable()> tag on top of the corresponding property names or public variables, as required.

My questions are: 1. What causes this error?
2. Do I need to add values or initialize the service object before doing the deserialization or do I leave the object empty since all the data is in the jsonstring?
3. Please refer me to a good tutorial on how to deserialize the object properties, with the List (Of Object).
4. I suspect the problem has to do with the : Return list (Of lds) but I can't see how. Is this Return statement correct.

Please assist. I have tried the net with no luck and am desperate now. Thanks

Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>