All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rmn.jsonapi.formatters.UndefinedFormatter.scala Maven / Gradle / Ivy

The newest version!
package com.rmn.jsonapi.formatters

import com.rmn.jsonapi.Undefined
import play.api.libs.json._

class UndefinedFormatter extends TypeFormatter[Undefined] {
  def reads(json: JsValue) : JsResult[Undefined] = JsSuccess(Undefined)
  def writes(item: Undefined) : JsValue = JsNull
  def readAt(path : JsPath) : Reads[Undefined] = path.readNullable[Undefined](this).map(_.getOrElse(Undefined))
  def writeAt(path: JsPath) : OWrites[Undefined] = OWrites[Undefined]{ _ => Json.obj()}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy