Class JsonPropertyAttribute
Instructs the JsonSerializer to always serialize the member with the specified name.
Inheritance
Implements
Inherited Members
Namespace: Bayat.Json
Assembly: Bayat.Json.Runtime.dll
Syntax
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class JsonPropertyAttribute : Attribute, _Attribute
Constructors
| Improve this Doc View SourceJsonPropertyAttribute()
Initializes a new instance of the JsonPropertyAttribute class.
Declaration
public JsonPropertyAttribute()
JsonPropertyAttribute(String)
Initializes a new instance of the JsonPropertyAttribute class with the specified name.
Declaration
public JsonPropertyAttribute(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | Name of the property. |
Properties
| Improve this Doc View SourceDefaultValueHandling
Gets or sets the default value handling used when serializing this property.
Declaration
public DefaultValueHandling DefaultValueHandling { get; set; }
Property Value
Type | Description |
---|---|
DefaultValueHandling | The default value handling. |
IsReference
Gets or sets whether this property's value is serialized as a reference.
Declaration
public bool IsReference { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Whether this property's value is serialized as a reference. |
ItemConverterParameters
The parameter list to use when constructing the JsonConverter described by ItemConverterType. If null, the default constructor is used. When non-null, there must be a constructor defined in the JsonConverter that exactly matches the number, order, and type of these parameters.
Declaration
public object[] ItemConverterParameters { get; set; }
Property Value
Type | Description |
---|---|
System.Object[] |
Examples
[JsonProperty(ItemConverterType = typeof(MyContainerConverter), ItemConverterParameters = new object[] { 123, "Four" })]
| Improve this Doc View SourceItemConverterType
Gets or sets the converter used when serializing the property's collection items.
Declaration
public Type ItemConverterType { get; set; }
Property Value
Type | Description |
---|---|
System.Type | The collection's items converter. |
ItemIsReference
Gets or sets whether this property's collection items are serialized as a reference.
Declaration
public bool ItemIsReference { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Whether this property's collection items are serialized as a reference. |
ItemReferenceLoopHandling
Gets or sets the the reference loop handling used when serializing the property's collection items.
Declaration
public ReferenceLoopHandling ItemReferenceLoopHandling { get; set; }
Property Value
Type | Description |
---|---|
ReferenceLoopHandling | The collection's items reference loop handling. |
ItemTypeNameHandling
Gets or sets the the type name handling used when serializing the property's collection items.
Declaration
public TypeNameHandling ItemTypeNameHandling { get; set; }
Property Value
Type | Description |
---|---|
TypeNameHandling | The collection's items type name handling. |
NullValueHandling
Gets or sets the null value handling used when serializing this property.
Declaration
public NullValueHandling NullValueHandling { get; set; }
Property Value
Type | Description |
---|---|
NullValueHandling | The null value handling. |
ObjectCreationHandling
Gets or sets the object creation handling used when deserializing this property.
Declaration
public ObjectCreationHandling ObjectCreationHandling { get; set; }
Property Value
Type | Description |
---|---|
ObjectCreationHandling | The object creation handling. |
Order
Gets or sets the order of serialization of a member.
Declaration
public int Order { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The numeric order of serialization. |
PropertyName
Gets or sets the name of the property.
Declaration
public string PropertyName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the property. |
ReferenceLoopHandling
Gets or sets the reference loop handling used when serializing this property.
Declaration
public ReferenceLoopHandling ReferenceLoopHandling { get; set; }
Property Value
Type | Description |
---|---|
ReferenceLoopHandling | The reference loop handling. |
Required
Gets or sets a value indicating whether this property is required.
Declaration
public Required Required { get; set; }
Property Value
Type | Description |
---|---|
Required | A value indicating whether this property is required. |
TypeNameHandling
Gets or sets the type name handling used when serializing this property.
Declaration
public TypeNameHandling TypeNameHandling { get; set; }
Property Value
Type | Description |
---|---|
TypeNameHandling | The type name handling. |