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

net.hamnaberg.json.collection.extension.ErrorsExtension.scala Maven / Gradle / Ivy

There is a newer version: 2.5
Show newest version
package net.hamnaberg.json.collection.extension

import net.hamnaberg.json.collection.{Extensible, Error, JsonCollection}
import org.json4s._
import net.hamnaberg.json.collection.Json4sHelpers._

/**
 * @author Erlend Hamnaberg
 */
object ErrorsExtension extends Extension[JsonCollection, List[Error]] {
  def apply(like: JsonCollection) = getAsObjectList(like.underlying, "errors").map(Error(_))

  def asJson(ext: List[Error], parent: Extensible[_]) = List(JField("errors", JArray(ext.map(_.underlying))))
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy