c# - Deserialize json data without using Json.net -
I am working in a schedule agent. My schedule agent has data in Jason format. I tried to do Json.net in the schedule agent to deserialize json in the list, but it is not working in the schedule agent. Can someone tell me how can I waste Jason data on the list without using Jsonssoft.dll ?? I am using the following code to convert json to the list but it is emptying me to the childlist ... Here is the conference modal class
list & lt; ConferenSodel & gt; Childlist = new list & lt; Conference session & gt; (); Memorystream ms = new memorystream (encoding.utf 8. gatbates (Responsecentant)); DataContractJsonSerializer ser = New DataContractJsonSerializer (childlist.GetType ()); As a list of Childlist = ser.ReadObject (MS) & lt; ConferenceSmodel>
public class conference {public string id {get; Set; } Public string datetime {get; Set; } Public string updateDateTime {get; Set; } Public intern {duration}; Set; } Public string description {get; Set; } Private bool _isEditDeleteVisible; } Public Sector ConferenceModel {Public List & lt; Conference & gt; Meetings {Receive; Set; Try using DataContract Annotation in your model DataContractJsonSerializer and it should work just fine:
[DataContract] Public class conference {[Datamember ] Public string id {get; Set; } [Datamember] get public string datetime {receive; Set; } [Database] Public String UpdateDate {Receive; Set; } [Datamember] get public entity {duration; Set; } [Datamember] public string description {get; Set; } [Unknowndatamber] private boole_itiddewallible; } [DataContract] Public Class ConferenceModel {[Database] Public List & lt; Conference & gt; Meetings {Receive; Set; Edit}: Code should also be fixed - it has been worked for me:
MemoryStream ms = new MemoryStream (encoding UTF8.GetBytes (s)); DataContractJsonSerializer ser = New Datactactogen Surger (typef (conferensodel)); ConferenceModel Childlist = (ConferenceModel) ser.ReadObject (ms);
Comments
Post a Comment