JsValueMapper

Best Practice for Case Class Json Mapping:

  1. make the case class derives JsValueMapper.
  2. or declare a given JsValueMaper[T] for the case class

otherwise, every time you use API which using a JsValueMapper[T], a new JsValueMapper[T] will be created via the JsValueMapper.given_JsValueMapper_T macro. this is an expensive operation, every macro expansion will generate an anonumous implementation class. so, there will be a lot of classes in the compilation and increase the compile time, the output jar file will be large.

Companion:
class
class Object
trait Matchable
class Any

Value members

Concrete methods

inline def caseFieldGet[T : JsValueMapper](js: JsObject, name: String): T
inline def caseFieldGet[T : JsValueMapper](js: JsObject, name: String, default: T): T
inline def derived[T](using ProductOf[T]): JsValueMapper[T]

Givens

Givens

given given_JsValueMapper_Array[T : ClassTag]: given_JsValueMapper_Array[T]
given given_JsValueMapper_C[T : JsValueMapper, C[_] : Container]: given_JsValueMapper_C[T, C]
given given_JsValueMapper_Map[T : JsValueMapper]: given_JsValueMapper_Map[T]
given given_JsValueMapper_Option[T : JsValueMapper]: given_JsValueMapper_Option[T]
given given_JsValueMapper_SortedMap[T : JsValueMapper]: given_JsValueMapper_SortedMap[T]
given given_JsValueMapper_SortedSet[T : Ordering]: given_JsValueMapper_SortedSet[T]
given given_JsValueMapper_T[T](using ProductOf[T]): JsValueMapper[T]

the T.derived has high priority than JsValMapper.given so if you define the derives, this macro will not be used.

the T.derived has high priority than JsValMapper.given so if you define the derives, this macro will not be used.