C# Class ConoHaNet.Objects.IPAddressDetailsConverter

This implementation of JsonConverter allows for JSON serialization and deserialization of IPAddress objects in the "address details" format used by operations such as IComputeProvider.ListAddresses and IComputeProvider.ListAddressesByNetwork.
Inheritance: Newtonsoft.Json.JsonConverter
Show file Open project: crowdy/OpenStack-ConoHa

Public Methods

Method Description
CanConvert ( Type objectType ) : bool
ReadJson ( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer ) : object Deserialization is performed by deserializing the JSON value as an AddressDetails object, following by using IPAddress.Parse to convert the value of AddressDetails.Address to an IPAddress instance.
WriteJson ( JsonWriter writer, object value, JsonSerializer serializer ) : void Serialization is performed by creating an AddressDetails instance equivalent to the given IPAddress instance and serializing that as a JSON object.

Method Details

CanConvert() public method

public CanConvert ( Type objectType ) : bool
objectType System.Type
return bool

ReadJson() public method

Deserialization is performed by deserializing the JSON value as an AddressDetails object, following by using IPAddress.Parse to convert the value of AddressDetails.Address to an IPAddress instance.
public ReadJson ( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer ) : object
reader Newtonsoft.Json.JsonReader
objectType System.Type
existingValue object
serializer Newtonsoft.Json.JsonSerializer
return object

WriteJson() public method

Serialization is performed by creating an AddressDetails instance equivalent to the given IPAddress instance and serializing that as a JSON object.
public WriteJson ( JsonWriter writer, object value, JsonSerializer serializer ) : void
writer Newtonsoft.Json.JsonWriter
value object
serializer Newtonsoft.Json.JsonSerializer
return void