Class StringEnumConverter
- Namespace
- Newtonsoft.Json.Converters
- Assembly
- Newtonsoft.Json.dll
Converts an Enum to and from its name string value.
public class StringEnumConverter : JsonConverter
- Inheritance
-
StringEnumConverter
- Inherited Members
Constructors
StringEnumConverter()
public StringEnumConverter()
Properties
CamelCaseText
Gets or sets a value indicating whether the written enum text should be camel case.
public bool CamelCaseText { get; set; }
Property Value
- bool
true
if the written enum text will be camel case; otherwise,false
.
Methods
CanConvert(Type)
Determines whether this instance can convert the specified object type.
public override bool CanConvert(Type objectType)
Parameters
objectType
TypeType of the object.
Returns
- bool
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
JsonReaderThe JsonReader to read from.
objectType
TypeType of the object.
existingValue
objectThe existing value of object being read.
serializer
JsonSerializerThe 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
JsonWriterThe JsonWriter to write to.
value
objectThe value.
serializer
JsonSerializerThe calling serializer.