JsonPropertyAttribute
Namespace: SnowBank.Data.Json · class
Implements: Attribute
Attribute that controls how a field or property is serialized into JSON
Constructors
JsonPropertyAttribute
JsonPropertyAttribute()
Configure how this field or property is serialized into JSON
JsonPropertyAttribute(string propertyName)
Configure how this field or property is serialized into JSON
Properties
DefaultValue
object DefaultValue { get; set; }
Default value for this property
If not specified, will use the default value for the member type (null, false, 0, ...)
EnumFormat
JsonEnumFormat EnumFormat { get; set; }
Defines if this field should be always serialized as strings (true), as integers (false), or according to the runtime json settings (null)
NumberFormat
JsonNumberFormat NumberFormat { get; set; }
Defines if this numeric field is serialized as a number (the default) or as a string literal
Reading always accepts both forms, whatever this setting says. The string form protects 64-bit values from the precision loss of JavaScript consumers.
PropertyName
string PropertyName { get; set; }
Name of the property
If not specified, will use the exact name of the field or property