Now play-json stand-alone is officially a stand-alone module in Play2.2. So you don’t have to use the dependency given in this article anymore but use Typesafe one like com.typesafe.play:play-json:2.2
In a very recent Pull Request, `play-json has been made a stand-alone module in Play2.2-SNAPSHOT master as play-iteratees.
It means:
- You can take Play2 Scala Json API as a stand-alone library and keep using Json philosophy promoted by Play Framework anywhere.
play-json
module is stand-alone in terms of dependencies but is a part & parcel of Play2.2 so it will evolve and follow Play2.x releases (and following versions) always ensuring full compatibility with play ecosystem.play-json
module has 3 ultra lightweight dependencies:-
play-functional
-
play-datacommons
-
play-iteratees
-
These are pure Scala generic pieces of code from Play framework so no Netty or whatever dependencies in it.
You can then import play-json
in your project without any fear of bringing unwanted deps.
play-json
will be released with future Play2.2 certainly so meanwhile, I provide:
- a build published in my Maven Github repository
- a sample project called play-json-alone
Even if the version is 2.2-SNAPSHOT, be aware that this is the same code as the one released in Play 2.1.0. This API has reached a good stability level. Enhancements and bug corrections will be brought to it but it’s production-ready right now.
Adding play-json 2.2-SNAPSHOT in your dependencies
In your Build.scala
, add:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
Using play-json 2.2-SNAPSHOT in your code:
Just import the following and get everything from Play2.1 Json API:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
Using
play-json
, you can get some bits of Play Framework pure Web philosophy.
Naturally, to unleash its full power, don’t hesitate to dive into Play Framework and discover 100% full Web Reactive Stack ;)
Thanks a lot to Play Framework team for promoting play-json as stand-alone module!
Lots of interesting features incoming soon ;)
Have fun!