This project has moved and is read-only. For the latest updates, please go here.


Apply JsonDictionaryAttributes to properties


It would be nice if the JsonDictionaryAttribute could be applied to properties so I could do things like
class MyDataObject {
public Dictionary<string, int> MyCustomSerializedCollection { get; set; }
Closed May 5, 2012 at 9:48 AM by JamesNK
Done. Its added to JsonProperty rather than JsonDictionaryAttribute, i.e. [JsonProperty(ItemConverterType = typeof(BlahConverter))]


erikkallen wrote Apr 27, 2012 at 12:50 PM

I know it is intended to be put on a class, that is the problem. It would be (IMO) much more useful to put it on a property, as it is rather unusual to implement dictionary classes, but very common to use them.

Might be too complicated, though, I don't know.

ejball wrote May 1, 2012 at 7:17 PM

I agree; the ability to customize the converter for the items of an array or dictionary property would be extremely useful. To make matters worse, I have not been able to discover any sort of workaround.

JamesNK wrote May 3, 2012 at 1:22 PM

That attribute is designed to be put on a class, not property. Also too complicated to implement.

** Closed by JamesNK 4/27/2012 4:38 AM

JamesNK wrote May 3, 2012 at 1:22 PM

By popular demand. Also I had an idea of how this could be done.

wrote May 5, 2012 at 9:48 AM

wrote Feb 22, 2013 at 2:48 AM

wrote May 16, 2013 at 1:37 PM