Class JsonWriterExtensions
- Namespace
- Codebelt.Extensions.Newtonsoft.Json
- Assembly
- Codebelt.Extensions.Newtonsoft.Json.dll
Extension methods for the Newtonsoft.Json.JsonWriter.
public static class JsonWriterExtensions
- Inheritance
-
JsonWriterExtensions
Methods
WriteObject(JsonWriter, Object, JsonSerializer)
Serializes the specified value
and writes the JSON structure using the specified writer
.
public static void WriteObject(this JsonWriter writer, object value, JsonSerializer serializer)
Parameters
writer
JsonWriterThe Newtonsoft.Json.JsonWriter used to write the JSON structure.
value
ObjectThe Object to serialize.
serializer
JsonSerializerThe calling Newtonsoft.Json.JsonSerializer.
WritePropertyName(JsonWriter, String, JsonSerializer, Boolean)
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
JsonWriterThe Newtonsoft.Json.JsonWriter used to write the JSON structure.
name
StringThe name of the property.
serializer
JsonSerializerThe calling Newtonsoft.Json.JsonSerializer.
escape
BooleanA 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.