KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have some working code: String objstr = "{\"m_children\":[{\"m_children\":null,\"m_name\":\"child0\"},{\"m_children\":null,\"m_name\":\"child1\"}],\"m_name\":\"Root\"}"; byte[] byteArr = Encoding.ASCII.GetBytes(objstr); MemoryStream ms = new MemoryStream(byteArr); DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Node)); Node obj = (Node)ser.ReadObject(ms); What bugs me is that I have to know the type of the object contained in the string before I decode it. I wanted to send an object encoded in JSON over a TCP pipe, and not have to send extra information about what type the object is.
Tags (comma-separated)
Save Edits
Cancel