Table of Contents

Class NewtonsoftHttpMethodConverter

Namespace
Vonage.Common.Serialization
Assembly
Vonage.dll

Represents a custom converter from HttpMethod to Json for Newtonsoft.Json.

public class NewtonsoftHttpMethodConverter : JsonConverter<HttpMethod>
Inheritance
JsonConverter
JsonConverter<HttpMethod>
NewtonsoftHttpMethodConverter
Inherited Members
JsonConverter.CanRead
JsonConverter.CanWrite

Examples

var settings = new JsonSerializerSettings();
settings.Converters.Add(new NewtonsoftHttpMethodConverter());

string json = JsonConvert.SerializeObject(HttpMethod.Get, settings);
// Produces: "GET"

Methods

ReadJson(JsonReader, Type, HttpMethod, bool, JsonSerializer)

Reads the JSON representation of the object.

public override HttpMethod ReadJson(JsonReader reader, Type objectType, HttpMethod existingValue, bool hasExistingValue, JsonSerializer serializer)

Parameters

reader JsonReader

The Newtonsoft.Json.JsonReader to read from.

objectType Type

Type of the object.

existingValue HttpMethod

The existing value of object being read. If there is no existing value then null will be used.

hasExistingValue bool

The existing value has a value.

serializer JsonSerializer

The calling serializer.

Returns

HttpMethod

The object value.

WriteJson(JsonWriter, HttpMethod, JsonSerializer)

Writes the JSON representation of the object.

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

Parameters

writer JsonWriter

The Newtonsoft.Json.JsonWriter to write to.

value HttpMethod

The value.

serializer JsonSerializer

The calling serializer.