Custom C# Class Name from JSON

I have some JSON that nicely deserializes (with DataContractJsonSerializer) to:

class Datum { /* properties */ }

Is there a decoration (in WinRT) to trick the Serializer?

Something like this:

[DataContract(Name="Datum")]
class Hamburger { /* properties */ }

Unfortunately that does not work.

I just want a Hamburger class, not a "Datum" class.

Possible?

Answers


Well [DataContract(Name="Datum")] is the right answer. What appears to be my problem is that once you use [DataContract] you need to use [DataMember] on all the properties. Otherwise, all the properties are null after it is deserialized.


Need Your Help

How to draw an inline style label (or button) inside NSMenuItem

objective-c macos cocoa nsmenu nsmenuitem

When App Store has updates, it shows an inline style element in the menu item, like '1 new' in the screenshot below: