title: How can I deserialize elementary types from json in ASP.NET(System.Runtime.Serialization.Json)
body: <p>I have a little problem.
  When I'm using <code>DataContractJsonSerializer</code> with complex types(own types) it works fine. But I have to deserialize TimeStamp or DateTime from a string. So I cant mark these types with DataContract, DataMember attributes.</p>
  
  <p>I wrote some code</p>
  
  <pre><code>string jsonedTS = "PT2M15S";
  
  DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(TimeSpan));
  MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonedTS));
  try {
      result.Takes = (TimeSpan) jsonSerializer.ReadObject(ms);
  } catch {
   ;
  }
  </code></pre>
  
  <p>And I catch this Exception</p>
  
  <blockquote>
    <p>{"There was an error deserializing the object of type System.TimeSpan. Encountered unexpected character 'P'."} System.Exception {System.Runtime.Serialization.SerializationException}</p>
  </blockquote>
  
  <p>And My Question IS
  How Can I deserialize</p>