Table of Contents

Class ExceptionConverter

Namespace
Cuemon.Extensions.Newtonsoft.Json.Converters
Assembly
Cuemon.Extensions.Newtonsoft.Json.dll

Converts an System.Exception to or from JSON.

public class ExceptionConverter : JsonConverter
Inheritance
Object
JsonConverter
ExceptionConverter
Inherited Members
JsonConverter.CanRead
JsonConverter.CanWrite

Constructors

ExceptionConverter(Boolean, Boolean)

Initializes a new instance of the ExceptionConverter class.

public ExceptionConverter(bool includeStackTrace = false, bool includeData = false)

Parameters

includeStackTrace Boolean

A value that indicates if the stack of an exception is included in the converted result.

includeData Boolean

A value that indicates if the data of an exception is included in the converted result.

Properties

IncludeData

Gets a value indicating whether the data of an exception is included in the converted result.

public bool IncludeData { get; }

Property Value

Boolean

true if the data of an exception is included in the converted result; otherwise, false.

IncludeStackTrace

Gets a value indicating whether the stack of an exception is included in the converted result.

public bool IncludeStackTrace { get; }

Property Value

Boolean

true if the stack of an exception is included in the converted result; otherwise, false.

Methods

CanConvert(Type)

Determines whether this instance can convert the specified object type.

public override bool CanConvert(Type objectType)

Parameters

objectType Type

Type of the object.

Returns

Boolean

true if this instance can convert the specified object type; otherwise, false.

ReadJson(JsonReader, Type, Object, JsonSerializer)

Reads the JSON representation of the object.

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)

Parameters

reader JsonReader

The Newtonsoft.Json.JsonReader to read from.

objectType Type

Type of the object.

existingValue Object

The existing value of object being read.

serializer JsonSerializer

The calling serializer.

Returns

Object

The object value.

WriteJson(JsonWriter, Object, JsonSerializer)

Writes the JSON representation of the object.

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)

Parameters

writer JsonWriter

The Newtonsoft.Json.JsonWriter to write to.

value Object

The value.

serializer JsonSerializer

The calling serializer.

See Also

JsonConverter