Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Voitot committed Feb 20, 2012
1 parent a7391e5 commit 0f5a5ab
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions README.md
@@ -1,7 +1,9 @@
# Play2 Rich Json Tool
`# Play2 Rich Json Tool

> Some sugar syntax to write your Play2/Scala JSON in a more compact way
val richJson = "this" : ( "is" \: ( "my" @@ ( "times" \: 1 ) @@ "play2" @@ "tool" ) )

## Example

Take the following JSON:
Expand Down Expand Up @@ -89,7 +91,35 @@ Isn't it more compact ?

## Doc

### Import the implicits conversion in your local context
### Build RichJson Jar (till this is in an online repo)

#### Git clone the project

git clone git://github.com/mandubian/play2-scala-richjson.git


#### Build RichJson

> sbt compile publish-local
It should publish into your local Ivy repository. For ex: "/Users/USERNAME/.ivy2/local" on a Mac


#### Add RichJson dependency to your `$YOUR_PLAY_APP/project/Build.scala`

val appDependencies = Seq(
// Add your project dependencies here,
"play.tools.richjson" %% "play-2.0-scala-richjson-tool" % "0.1-SNAPSHOT"
)

// need to update to your own repo (put the right directory)
val moduleRepo = Resolver.file("local repository", file("/Users/USERNAME/.ivy2/local"))(Resolver.ivyStylePatterns)

val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
resolvers += moduleRepo,
resolvers += ("typesafe snapshots" at "http://repo.typesafe.com/typesafe/snapshots/")
)

### Import the implicits conversion in your local context (for ex, an action in a controller)

// classic JSON imports
import play.api.libs.json._
Expand All @@ -107,7 +137,7 @@ Here are the correspondences between Json & RichJson syntax :

RichJson returns a classic Play2/Scala _JsObject_

val richJson:JsObject = "key" \: "value"
val richJson:JsObject = "key" \: "value"


Have Fun

0 comments on commit 0f5a5ab

Please sign in to comment.