CrystalJsonConverterAttribute

Namespace: SnowBank.Data.Json · class

Implements: CrystalConverterAttribute

Mono-format alias that marks a partial class as a container of source-generated JSON converters

Remarks

This attribute should be applied on a partial class, that will act as a container for all generated types.

It is exactly equivalent to [CrystalConverter] plus [CrystalJsonOutput(...)] with the same parameters, and is the shortest spelling for the common case of a container that only ever produces JSON.

Being mono-format, it does not combine with another output format: pairing it with [CrystalXmlOutput] is rejected (CRYS0002). A container that produces several outputs spells out [CrystalConverter] and one [Crystal<Format>Output] per output.

All "root" data types should be included via the CrystalSerializableAttribute attribute

Sample: [CrystalJsonConverter] [CrystalSerializable(typeof(User))] [CrystalSerializable(typeof(Product))] // ... one for each "top level" type, nested/linked types are automatically discovered public static partial class ApplicationSerializers { // generated code will be inserted here }

Constructors

CrystalJsonConverterAttribute

CrystalJsonConverterAttribute()

Use this class as a container for source-generated JSON converters

CrystalJsonConverterAttribute(CrystalJsonSerializerDefaults defaults)

Use this class as a container for source-generated JSON converters

  • defaults — Defaults settings used for the generated converters

Properties

PropertyNameCaseInsensitive

bool PropertyNameCaseInsensitive { get; set; }

Gets or sets the default value of IgnoreCaseForNames.

PropertyNamingPolicy

CrystalJsonKnownNamingPolicy PropertyNamingPolicy { get; set; }

Gets or sets a built-in naming policy to convert JSON property names with.