Table of Contents

Class JsonPropertyAttribute

Namespace
Newtonsoft.Json
Assembly
Newtonsoft.Json.dll

Instructs the JsonSerializer to always serialize the member with the specified name.

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class JsonPropertyAttribute : Attribute
Inheritance
JsonPropertyAttribute
Inherited Members

Constructors

JsonPropertyAttribute()

Initializes a new instance of the JsonPropertyAttribute class.

public JsonPropertyAttribute()

JsonPropertyAttribute(string)

Initializes a new instance of the JsonPropertyAttribute class with the specified name.

public JsonPropertyAttribute(string propertyName)

Parameters

propertyName string

Name of the property.

Properties

DefaultValueHandling

Gets or sets the default value handling used when serializing this property.

public DefaultValueHandling DefaultValueHandling { get; set; }

Property Value

DefaultValueHandling

The default value handling.

IsReference

Gets or sets whether this property's value is serialized as a reference.

public bool IsReference { get; set; }

Property Value

bool

Whether this property's value is serialized as a reference.

NullValueHandling

Gets or sets the null value handling used when serializing this property.

public NullValueHandling NullValueHandling { get; set; }

Property Value

NullValueHandling

The null value handling.

ObjectCreationHandling

Gets or sets the object creation handling used when deserializing this property.

public ObjectCreationHandling ObjectCreationHandling { get; set; }

Property Value

ObjectCreationHandling

The object creation handling.

Order

Gets or sets the order of serialization and deserialization of a member.

public int Order { get; set; }

Property Value

int

The numeric order of serialization or deserialization.

PropertyName

Gets or sets the name of the property.

public string PropertyName { get; set; }

Property Value

string

The name of the property.

ReferenceLoopHandling

Gets or sets the reference loop handling used when serializing this property.

public ReferenceLoopHandling ReferenceLoopHandling { get; set; }

Property Value

ReferenceLoopHandling

The reference loop handling.

Required

Gets or sets a value indicating whether this property is required.

public Required Required { get; set; }

Property Value

Required

A value indicating whether this property is required.

TypeNameHandling

Gets or sets the type name handling used when serializing this property.

public TypeNameHandling TypeNameHandling { get; set; }

Property Value

TypeNameHandling

The type name handling.