[2.0-scala] Extract the JSON library?

306 views
Skip to first unread message

Alex Dean

unread,
Jan 19, 2013, 7:21:00 PM1/19/13
to play-fr...@googlegroups.com
Hi,

A bit of a random one this - it feels like Play 2.0 now has includes one of two best JSON libraries in Scala land (Jerkson is abandonware, which leaves the other interesting one being https://github.com/json4s/json4s). And so I wondered: are there any plans to extract Play's JSON library and make it a standalone Typesafe library - a little like https://github.com/typesafehub/config for configuration.

No worries if not - but I hope the answer is yes, as I'm keen to use the library in non-Play projects (e.g. Scalding MapReduce jobs)...

Thanks,

Alex

Kim Stebel

unread,
Jan 20, 2013, 12:38:54 AM1/20/13
to play-fr...@googlegroups.com
It might not be exactly what you are looking for, but spray-json is quite similar to Play's approach and is already a separate library.

--
 
 

Alex Dean

unread,
Jan 20, 2013, 7:38:36 AM1/20/13
to play-fr...@googlegroups.com
Thanks for the link Kim - yep, JSON libraries are the Scala community's writing a todo list app, I think there are six or seven now? ;-)

I guess my point is, in the face of "JSON library proliferation", it would be nice to have an "official" Typesafe one, and the one within the Play Framework seems to be a perfectly good fit for this (it's based on Jackson and is strongly typesafe).

To play devil's advocate for a minute: either the Play JSON library is better than the alternatives (in which case it's only really fair to extract it and share it with the wider Scala community), or Play has fallen victim to NIH and should really be using one of the competing libraries...

Cheers,

Alex

James Roper

unread,
Jan 20, 2013, 7:59:08 PM1/20/13
to play-framework
I guess my point is, in the face of "JSON library proliferation", it would be nice to have an "official" Typesafe one, and the one within the Play Framework seems to be a perfectly good fit for this (it's based on Jackson and is strongly typesafe).

I don't think it's necessary to have an official Typesafe JSON library, and for something like a JSON library, where it's a problem domain with a small surface area and well defined boundaries, I think diversity is in fact very healthy.

To play devil's advocate for a minute: either the Play JSON library is better than the alternatives (in which case it's only really fair to extract it and share it with the wider Scala community), or Play has fallen victim to NIH and should really be using one of the competing libraries...

Given that macros are still considered an experimental feature of Scala, and Scala 2.10 has only been released for less than a month, I don't think this is a correct assessment of the situation.  It can't be NIH syndrome, since it was impossible for a macro based JSON solution to exist before Scala macros existed, and we wanted a macro based JSON library in Play, so we had to implement it ourselves.  On whether the Play JSON library is better than the alternatives, the jury is still out on that.  The JSON macros are still considered experimental.  Until we get heavy real world use of them, I don't think we can make that call.  Don't get me wrong, of course we think that it's the best Scala JSON library out there, but let's not jump to conclusions too soon.
 

Cheers,

Alex

On Sunday, January 20, 2013 5:38:54 AM UTC, Kim Stebel wrote:
It might not be exactly what you are looking for, but spray-json is quite similar to Play's approach and is already a separate library.

On Sun, Jan 20, 2013 at 1:21 AM, Alex Dean <al...@snowplowanalytics.com> wrote:
Hi,

A bit of a random one this - it feels like Play 2.0 now has includes one of two best JSON libraries in Scala land (Jerkson is abandonware, which leaves the other interesting one being https://github.com/json4s/json4s). And so I wondered: are there any plans to extract Play's JSON library and make it a standalone Typesafe library - a little like https://github.com/typesafehub/config for configuration.

No worries if not - but I hope the answer is yes, as I'm keen to use the library in non-Play projects (e.g. Scalding MapReduce jobs)...

Thanks,

Alex

--
 
 

--
 
 



--
James Roper
Software Engineer

Typesafe - The software stack for applications that scale
Twitter: @jroper

Alex Dean

unread,
Jan 21, 2013, 7:21:59 AM1/21/13
to play-fr...@googlegroups.com
Hi James,

I hadn't appreciated the macro-based/experimental nature of the Play JSON library. In that case, it definitely makes to hold off from extracting and see how it scales in the real-world.

for something like a JSON library, where it's a problem domain with a small surface area and well defined boundaries, I think diversity is in fact very healthy.

I disagree - the vast majority of programming languages/environments have a bundled/"batteries included" JSON library plus 0-3 alternate competing implementations. Scala having no official JSON library and 6-7 alternate libraries is not healthy diversity, it's just confusing and leads to major projects like Scalding using abandonware (Jerkson), and apps bundling 2 or 3 different JSON libraries because their component library authors' drew different JSON libraries out of the hat.

The other trouble is that 6-7 different implementations means 6-7 (very slightly different) ASTs, which actually makes it impossible for an app or library to robustly expose a standard `JsonObject` or similar to other software.

If Typesafe is happy with the JSON proliferation, perhaps at least Play's JSON implementation should move to support json4s, which is trying to do something to standardise JSON in Scala:


Pascal Voitot Dev

unread,
Jan 21, 2013, 9:10:58 AM1/21/13
to play-fr...@googlegroups.com
By the way, JSon macros are just tools built on top of JSon API.
So yes it's experimental but it's not mandatory to use them if you want to have something more stable.

Regards
Pascal

--
 
 

Reply all
Reply to author
Forward
0 new messages