JamesNK / Newtonsoft.Json

Json.NET is a popular high-performance JSON framework for .NET
https://www.newtonsoft.com/json
MIT License
10.83k stars 3.26k forks source link

JsonConverter and NamingStrategy #1069

Open juangabreil opened 8 years ago

juangabreil commented 8 years ago

Hi all,

is it possible to use naming strategy from JsonConverter so that it can be configured?

Thanks in advance.

juangabreil commented 8 years ago

Just to add more information, the idea should be:

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
      var someClass = (SomeClass) value;
      var jObject = new JObject {{namingStrategy.GetPropertyName("Text", true/false), literalValue.Value}};
      jObject.WriteTo(writer);
}