Packages

  • package root
    Definition Classes
    root
  • package play

    Play framework.

    Play framework.

    Play

    http://www.playframework.com

    Definition Classes
    root
  • package api

    Contains the public API for Scala developers.

    Contains the public API for Scala developers.

    Access the current Play application
    import play.api.Play.current
    Read configuration
    val poolSize = configuration.getInt("engine.pool.size")
    Use the logger
    Logger.info("Hello!")
    Define a Plugin
    class MyPlugin(app: Application) extends Plugin
    Create adhoc applications (for testing)
    val application = Application(new File("."), this.getClass.getClassloader, None, Play.Mode.DEV)
    Definition Classes
    play
  • package libs

    Contains various APIs that are useful while developing web applications.

    Contains various APIs that are useful while developing web applications.

    Definition Classes
    api
  • package json

    Json API For example:

    Json API For example:

    import play.api.libs.json._
    import play.api.libs.functional.syntax._
    
    case class User(id: Long, name: String, friends: Seq[User] = Seq.empty)
    object User {
    
      // In this format, an undefined friends property is mapped to an empty list
      implicit val format: Format[User] = (
        (__ \ "id").format[Long] and
        (__ \ "name").format[String] and
        (__ \ "friends").lazyFormatNullable(implicitly[Format[Seq[User]]])
          .inmap[Seq[User]](_ getOrElse Seq.empty, Some(_))
      )(User.apply, unlift(User.unapply))
    }
    
    //then in a controller:
    
    object MyController extends Controller {
       def displayUserAsJson(id: String) = Action {
          Ok(Json.toJson(User(id.toLong, "myName")))
       }
       def saveUser(jsonString: String)= Action {
         val user = Json.parse(jsonString).as[User]
         myDataStore.save(user)
         Ok
       }
    }
    Definition Classes
    libs
  • package jackson
    Definition Classes
    json
  • PlayJsonModule
  • package util
    Definition Classes
    json
p

play.api.libs.json

jackson

package jackson

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. sealed class PlayJsonModule extends SimpleModule

    The Play JSON module for Jackson.

    The Play JSON module for Jackson.

    This can be used if you want to use a custom Jackson ObjectMapper, or more advanced Jackson features when working with JsValue. To use this:

    import com.fasterxml.jackson.databind.ObjectMapper
    
    val jsonParseSettings = JsonParserSettings()
    val mapper = new ObjectMapper().registerModule(PlayJsonModule(jsonParseSettings))
    val jsValue = mapper.readValue("""{"foo":"bar"}""", classOf[JsValue])

Deprecated Value Members

  1. object PlayJsonModule extends PlayJsonModule
    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.11) Use PlayJsonModule class instead

Ungrouped