title: Decode JSON Object in C# without prior knowledge of type
body: <p>I have some working code:</p>
  
  <pre><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);
  </code></pre>
  
  <p>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.</p>