C# Class NSwag.Annotations.Converters.JsonExceptionConverter

A converter to correctly serialize exception objects.
Inheritance: Newtonsoft.Json.JsonConverter
Datei anzeigen Open project: NSwag/NSwag

Public Methods

Method Description
CanConvert ( Type objectType ) : bool

Determines whether this instance can convert the specified object type.

JsonExceptionConverter ( ) : System

Initializes a new instance of the JsonExceptionConverter class.

JsonExceptionConverter ( bool hideStackTrace, Assembly>.IDictionary searchedNamespaces ) : System

Initializes a new instance of the JsonExceptionConverter class.

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

Reads the JSON representation of the object.

WriteJson ( JsonWriter writer, object value, JsonSerializer serializer ) : void

Writes the JSON representation of the object.

Private Methods

Method Description
GetExceptionProperties ( Type exceptionType ) : string>.IDictionary
GetField ( Type type, string fieldName ) : FieldInfo
SetExceptionFieldValue ( Newtonsoft.Json.Linq.JObject jObject, string propertyName, object value, string fieldName, IContractResolver resolver, JsonSerializer serializer ) : void

Method Details

CanConvert() public method

Determines whether this instance can convert the specified object type.
public CanConvert ( Type objectType ) : bool
objectType System.Type Type of the object.
return bool

JsonExceptionConverter() public method

Initializes a new instance of the JsonExceptionConverter class.
public JsonExceptionConverter ( ) : System
return System

JsonExceptionConverter() public method

Initializes a new instance of the JsonExceptionConverter class.
public JsonExceptionConverter ( bool hideStackTrace, Assembly>.IDictionary searchedNamespaces ) : System
hideStackTrace bool If set to true the serializer hides stack trace (i.e. sets the StackTrace to 'HIDDEN').
searchedNamespaces Assembly>.IDictionary The namespaces to search for exception types.
return System

ReadJson() public method

Reads the JSON representation of the object.
public ReadJson ( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer ) : object
reader Newtonsoft.Json.JsonReader The to read from.
objectType System.Type Type of the object.
existingValue object The existing value of object being read.
serializer Newtonsoft.Json.JsonSerializer The calling serializer.
return object

WriteJson() public method

Writes the JSON representation of the object.
public WriteJson ( JsonWriter writer, object value, JsonSerializer serializer ) : void
writer Newtonsoft.Json.JsonWriter The to write to.
value object The value.
serializer Newtonsoft.Json.JsonSerializer The calling serializer.
return void