Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
75 views
in Technique[技术] by (71.8m points)

What JSON library to use in Scala?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Unfortunately writing a JSON library is the Scala community's version of coding a todo list app.

There are quite a variety of alternatives. I list them in no particular order, with notes:

  1. parsing.json.JSON - Warning this library is available only up to Scala version 2.9.x (removed in newer versions)
  2. spray-json - Extracted from the Spray project
  3. Jerkson ± - Warning a nice library (built on top of Java Jackson) but now abandonware. If you are going to use this, probably follow the Scalding project's example and use the backchat.io fork
  4. sjson - By Debasish Ghosh
  5. lift-json - Can be used separately from the Lift project
  6. json4s ?? § ± - An extraction from lift-json, which is attempting to create a standard JSON AST which other JSON libraries can use. Includes a Jackson-backed implementation
  7. Argonaut ?? § - A FP-oriented JSON library for Scala, from the people behind Scalaz
  8. play-json ± - Now available standalone, see this answer for details
  9. dijon - A handy, safe and efficient JSON library, uses jsoniter-scala under hood.
  10. sonofjson - JSON library aiming for a super-simple API
  11. Jawn - JSON library by Erik Osheim aiming for Jackson-or-faster speed
  12. Rapture JSON ± - a JSON front-end which can use 2, 4, 5, 6, 7, 11 or Jackson as back-ends
  13. circe ?? - fork of Argonaut built on top of cats instead of scalaz
  14. jsoniter-scala - Scala macros for compile-time generation of ultra-fast JSON codecs
  15. jackson-module-scala - Add-on module for Jackson to support Scala-specific datatypes
  16. borer - Efficient CBOR and JSON (de)serialization in Scala

?? = has not fixed security vulnerabilities, § = has Scalaz integration, ± = supports interop with Jackson JsonNode

In Snowplow we use json4s with the Jackson back-end; we've had good experiences with Argonaut too.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...