Open
Description
JsonConverter allows specifying the conveter to be used for a specific property, however if a collection is in use and you want to use the converter to serialize a items in collection it doesn't work.
Example
public enum Day
{
Sunday,
Monday,
}
public class Model
{
[JsonConverter(typeof(JsonStringEnumConverter))]
public IEnumerable<Day> Days { get; set; }
}
The above code will throw. The only way to work around is to write a custom converter which understands collections and uses a different converter for each item in collection.
I propose a new attribute which allows the caller to specify converter to use for items in collection should be added. Something like
[JsonCollectionItemConverter(typeof(JsonStringEnumConverter))]
Newtonsoft.Json allows this by allowing specifying the type in JsonProperty attribute. That option has it's own shortcomings as well. I believe the above option will solve that too.