Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Working on a Java and Scala code-base, there's a debate about whether to use Java's Jackson JSON or the Play Framework's JSON Library.

After reading the Play JSON Docs, as well as Chapter 9 (JSON) of Play for Scala, I also ran through an example from Mykong on Jackson.

Based on looking at a few simple examples, Play's JSON Library seems like the superior choice due to, overall, its Functional Programming Approach:

  • Providing compile-time safety when parsing JSON with Option/JsResult data types.
  • As a result of the above, higher order functions (map/flatMap) are available and provide power and succintness
  • As I understand, Jackson parses via the typical try/catch paradigm. Dealing with JSON errors at compile-time(Play) v. run-time(Jackson) is a no brainer

Bottom line - Play's JSON library uses a functional programming approach that results in code that is easier to reason about than the Jackson library.

Overall, the choice seems clear to me. Am I missing any pros/cons for either library?

share|improve this question

closed as off-topic by Bart van Ingen Schenau, gnat, MichaelT, GlenH7, Kilian Foth Feb 11 at 10:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, MichaelT, GlenH7, Kilian Foth
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Why the downvote? I believe that I've laid out a strong case for using Play's JSON Library, but am asking for more information on this debate. –  Kevin Meredith Feb 9 at 17:54
1  
+1. I'd suggest avoiding Jackson and spending some time with both Play JSON and Argonaut. They're both really good libraries, and are similar in many ways, but the differences in emphasis can teach you a lot about library design in Scala. –  Travis Brown Feb 9 at 21:38
add comment

1 Answer 1

up vote 1 down vote accepted

It's important to note, first of all, that the Play ScalaJSON library uses Jackson. In effect, it is a wrapper around the parsing/formatting engine provided by Jackson, so it's a really good alternative. It provides a nice API around a very fast engine.

Now, the library I'd pick today for any JSON work would be Argonaut. Argonaut is a true functional library from the ground up, and I like many of its decisions.

I don't really see any point in picking Jackson itself, unless you need the most speed you can get.

share|improve this answer
    
Thanks, Daniel. Is the compile-time distinction achieved with Play JSON by simply making use of Option (for parsing JSON) and JsResult (for validating JSON against a particular object)? –  Kevin Meredith Feb 10 at 4:05
    
@KevinMeredith I'm not sure I understand the question. –  Daniel C. Sobral Feb 10 at 15:34
    
Could you speak more as to how JSON inception enables compile time safety? –  Kevin Meredith Feb 24 at 2:47
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.