Type conversion Expression[String] to normal string

HI team,

could you help me in how to convert the Expression[String] to normal string

object Templates {
val template: Expression[String] = session => session(“payload”).as[String]
val converator: String= template.tostring;

it is printing the object

Expression[String] is an alias for Session => Validation[String]. So it’s a function, not a value.

Think of it as a reference to a method that takes a Session input parameter and returns a Validation[String]. It doesn’t make sense to ask to turn it into a String.

thanks @slandelle is there any other way to ask to turn it into a String.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.