title: Deserialization of JSON object by using DataContractJsonSerializer in C#
body: <p>I'm sure this question has been asked over and over again, but for some reason, I still can't manage to get this to work.</p>
  
  <p>I want to deserialize a JSON object that contains a single member; a string array:</p>
  
  <pre><code>[{"idTercero":"cod_Tercero"}]
  </code></pre>
  
  <p>This is the class that I'm trying to deserialize into:</p>
  
  <pre><code>[DataContract]
  public class rptaOk
  {
      [DataMember]
      public string idTercero { get; set; }
  
      public rptaOk() { }
  
      public rptaOk(string idTercero)
      {
          this.idTercero = idTercero;
      }
  }
  </code></pre>
  
  <p>This is the method that I try to deserialize:</p>
  
  <pre><code>public T Deserialise&lt;T&gt;(string json)
      {
          DataContractJsonSerializer deserializer = new DataContractJsonSerializer(typeof(T));
          using (MemoryStream stream = new MemoryStream(Encoding.Unicode.GetBytes(json)))
          {
              T result = (T)deserializer.ReadObject(stream);
              return result;
          }
      }
  </code></pre>
  
  <p>And so I try to fill the object:</p>
  
  <pre><code>rptaOk deserializedRpta = deserializarOk(rpta);
  </code></pre>
  
  <p>But for some reason, this returns ""</p>
  
  <pre><code>MessageBox.Show(deserializedRpta.idTercero);
  </code></pre>