class Converter extends
RootJsonFormat[TypeToConvert]
{
def write(obj : TypeToConvert) : JsValue =
{
obj match
{
case Https => JsString(Https.name)
case Sms => JsString(Sms.name)
}
}
def read(jsValue : JsValue) : TypeToConvert =
{
jsValue match
{
case JsString("HTTPS") => Https
case JsString("SMS") => Sms
case _ => throw
DeserializationException("Expected a TypeToConvert
Type")
}
}
}
I have written a converter like this and in this I am using only write method. Is there a way to write json formatters with only write method. I want to remove read method.