title: .NET JsonConverter Tuples List
body: <p>I'm trying to use a custom JsonConverter to convert a <code>List&lt;Tuple&lt;string,string&gt;&gt;</code> to a <code>List&lt;Tuple&lt;string, JRaw&gt;&gt;</code> during serilization. So if I have a <code>List&lt;Tuple&lt;string, string&gt;&gt;</code> when I preform <code>JsonConvert.SerializeObject</code> on that list I want it to serialize that list as if it was of type <code>List&lt;Tuple&lt;string,JRaw&gt;&gt;</code>. The reason being that the <code>Item2</code> field of the Tuple is already formatted Json, so I want to wrap it in a JRaw value so it doesn't get read as a string during serialization.</p>
  
  <p>Problem being the documentation on JsonConverters is kind of sparse. I've been looking at similar questions all over stack-overflow and google and can't seem to find a good tutorial on how to create JsonConverters. Any help with either this specific example or a link to a good tutorial would be awesome. </p>
  
  <p>For those of your who are curious this was my first attempt:</p>
  
  <p>```</p>
  
  <pre><code>public class DataJsonConverter : JsonConverter
  {
      public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
      {
          List&lt;Tuple&lt;string, JRaw&gt;&gt; jlist = ((List&lt;Tuple&lt;string, string&gt;&gt;)value).Select(t =&gt; new Tuple&lt;string, JRaw&gt;(t.Item1, new JRaw(t.Item2))).ToList();
          new JArray(jlist).WriteTo(writer);
  
      }
  
      public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
      {
          return JsonConvert.DeserializeObject&lt;List&lt;Tuple&lt;string, string&gt;&gt;&gt;(reader.ReadAsString());
      }
  
      public override bool CanConvert(Type objectType)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>```</p>
  
  <p>This should clear up any misconceptions that I know what I am doing when it comes to writing JsonConverters. Side note, I am also new to C# as a language coming from Java.</p>