scalauser
scalauser

Reputation: 449

add dependency to scala SBT project (import play.api.libs.json.Json)

I'm new to Scala and SBT.

I'm following this example: Play Framework

import play.api.libs.json.Json

val json: JsValue = Json.parse("""
{ 
"user": {
"name" : "toto",
"age" : 25,
"email" : "[email protected]",
"isAlive" : true,
"friend" : {
  "name" : "tata",
  "age" : 20,
  "email" : "[email protected]"
 }
} 
}
""")

How do you put the dependency for this library in the build.sbt file?

I'm using the Intellij scala IDE community edition.

Thanks

Upvotes: 2

Views: 2660

Answers (1)

dangig
dangig

Reputation: 189

This should already be included in a Play application. No need to add anything to the build.sbt file.

Here's how to create a new application: https://www.playframework.com/documentation/2.3.x/NewApplication

For information, here's the build.sbt that gets generated automatically when creating the app this way:

name := """app-name"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  jdbc,
  anorm,
  cache,
  ws
)

Hope this helps.

EDIT: Following your comment, according to this post, the dependency would be:

resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"    
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.3.4"

Upvotes: 3

Related Questions