Table of Contents

WritePropertyName Method

Definition

Namespace
Codebelt.Extensions.Newtonsoft.Json
Assemblies
Codebelt.Extensions.Newtonsoft.Json.dll
Source
src/Codebelt.Extensions.Newtonsoft.Json/JsonWriterExtensions.cs

WritePropertyName(JsonWriter, string, JsonSerializer, bool)

Writes the property name of a name/value pair of a JSON object.

public static void WritePropertyName(this JsonWriter writer, string name, JsonSerializer serializer, bool escape = false)

Parameters

writer JsonWriter

The Newtonsoft.Json.JsonWriter used to write the JSON structure.

name string

The name of the property.

serializer JsonSerializer

The calling Newtonsoft.Json.JsonSerializer.

escape bool

A flag to indicate whether the text should be escaped when it is written as a JSON property name.

Remarks

In order to support an assigned Newtonsoft.Json.Serialization.NamingStrategy to serializer, make sure Newtonsoft.Json.JsonSerializer.ContractResolver is assignable from Newtonsoft.Json.Serialization.DefaultContractResolver.