jackson-module-scala


License

License

Categories

Categories

Scala Languages Jackson Data JSON
GroupId

GroupId

com.fasterxml.jackson.module
ArtifactId

ArtifactId

jackson-module-scala_2.10
Last Version

Last Version

2.12.0-rc1
Release Date

Release Date

Type

Type

bundle
Description

Description

jackson-module-scala
jackson-module-scala
Project Organization

Project Organization

com.fasterxml.jackson.module
Source Code Management

Source Code Management

https://github.com/FasterXML/jackson-module-scala

Download jackson-module-scala_2.10

Dependencies

compile (5)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.10.7
com.fasterxml.jackson.core : jackson-core jar 2.12.0-rc1
com.fasterxml.jackson.core : jackson-annotations jar 2.12.0-rc1
com.fasterxml.jackson.core : jackson-databind jar 2.12.0-rc1
com.thoughtworks.paranamer : paranamer jar 2.8

test (7)

Group / Artifact Type Version
com.fasterxml.jackson.datatype : jackson-datatype-joda jar 2.12.0-rc1
com.fasterxml.jackson.datatype : jackson-datatype-guava jar 2.12.0-rc1
com.fasterxml.jackson.module : jackson-module-jsonSchema jar 2.12.0-rc1
io.swagger : swagger-core jar 1.6.2
org.scalatest : scalatest_2.10 jar 3.2.2
org.scalatestplus : junit-4-12_2.10 jar 3.2.2.0
junit : junit jar 4.13

Project Modules

There are no modules declared in this project.

Build Status Maven Central

Overview

Jackson is a fast JSON processor for Java that supports three models: streaming, node, and object mapping (akin to the three independent models SAX/[Stax], DOM and JAXB for XML processing).

The object mapping model is a high-level processing model that allows the user to project JSON data onto a domain-specific data model appropriate for their application, without having to deal with the low-level mechanics of JSON parsing. It is the standard object mapping parser implementaton in Jersey, the reference implementation for JSR-311 (Java API for Restful Web Services).

Scala is a functional programming language for the JVM that supports Java interoperability. Its standard library is quite distinct from Java, and does not fulfill the expectations of Jacksons default mappings. Notably, Scala collections do not derive from java.util.Collection or its subclasses, and Scala properties do not (by default) look like Java Bean properties.

The Scala Module supports serialization and limited deserialization of Scala Case Classes, Sequences, Maps, Tuples, Options, and Enumerations.

Caveats

Support for class constructor arguments currently depends upon Paranamer, specifically an implementation that depends upon constructor parameter names being present in the class debug information. Since this is the default in Scala, it is usually not an issue, but since it's possible to turn this off, be aware that the current version will throw an exception if it cannot find the constructor parameter names. Future versions may permit configuration to suppress this exception.

Usage

To use the Scala Module in Jackson, simply register it with the ObjectMapper instance:

// With 2.10 and later
val mapper = JsonMapper.builder()
  .addModule(DefaultScalaModule)
  .build()

// versions before 2.10 (also support for later 2.x but not 3.0)
val mapper = new ObjectMapper()
mapper.registerModule(DefaultScalaModule)

DefaultScalaModule is a Scala object that includes support for all currently supported Scala data types. If only partial support is desired, the component traits can be included individually:

val module = new OptionModule with TupleModule {}
val mapper = JsonMapper.builder()
  .addModule(module)
  .build()

You can also mixin ScalaObjectMapper to get rich wrappers that automatically convert scala manifests directly into TypeReferences for Jackson to use:

val mapper = new ObjectMapper() with ScalaObjectMapper
mapper.registerModule(DefaultScalaModule)
val myMap = mapper.readValue[Map[String,Tuple2[Int,Int]]](src)

Consult the Scaladoc for further details.

Building

The master branch often depends on SNAPSHOT versions of the core Jackson projects, which are published to the Sonatype OSS Repository. To make these dependencies available, create a file called sonatype.sbt in the same directory as build.sbt with the following content. The project .gitignore file intentionally prevents this file from being checked in.

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

Download, docs

Check out Wiki. API Scaladocs can be found on the project site but they are not really well suited to end users, as most classes are implementation details of the module.

Contributing

The main mechanisms for contribution are:

  • Reporting issues, suggesting improved functionality on Github issue tracker
  • Participating in discussions on mailing lists, Gitter (see Jackson portal for details)
  • Submitting Pull Requests (PRs) to fix issues, improve functionality.

Core Development Team

Currently active core developers (ones who can review, accept and merge Pull Requests) are:

  • Morten Kjetland (@mbknor)
  • Nate Bauernfeind (@nbauernfeind)
  • PJ Fanning (@pjfanning)

If you have questions on issues, implementation strategies, you may refer to core developers (and this is recommended if you are in doubt!), but keep in mind that these are voluntary positions: everyone is doing this because they want to, not because they are paid or contractually obligated to. This also means that time availability changes over time so getting answers may take time.

In addition other Jackson developers with similar access (but less active) include

  • Christopher Currie (@christophercurrie) -- original author of Scala module
  • Tatu Saloranta (@cowtowncoder) -- main author of core Jackson components

Acknowledgements

Developed with IntelliJ IDEA

com.fasterxml.jackson.module

FasterXML, LLC

Versions

Version
2.12.0-rc1
2.11.4
2.11.3
2.11.2
2.11.1
2.11.0
2.11.0.rc1
2.10.5
2.10.4
2.10.3
2.10.2
2.10.1
2.10.0.pr3
2.10.0.pr2
2.10.0.pr1
2.10.0
2.9.10
2.9.9
2.9.8
2.9.7
2.9.6
2.9.5
2.9.4
2.9.2
2.9.1
2.9.0.pr3
2.9.0.pr2
2.9.0.pr1
2.9.0
2.8.11
2.8.10
2.8.9
2.8.8
2.8.7
2.8.6
2.8.5
2.8.4
2.8.3
2.8.2
2.8.1
2.8.0.rc2
2.8.0.rc1
2.7.9
2.7.8
2.7.7
2.7.6
2.7.5
2.7.4
2.7.3
2.7.2
2.6.7.1
2.6.7
2.6.6
2.6.5
2.6.4
2.6.3
2.6.2
2.6.1
2.6.0-1
2.6.0
2.6.0-rc4
2.6.0-rc2
2.5.3
2.5.2
2.5.1
2.5.0
2.4.5-1
2.4.5
2.4.4
2.4.3
2.4.2
2.4.1
2.4.0
2.4.0-rc2
2.4.0-rc1
2.3.5
2.3.4
2.3.3
2.3.2
2.3.1
2.3.0
2.3.0-rc1
2.2.3
2.2.2
2.2.1
2.2.0
2.2.0-rc1
2.1.5
2.1.4
2.1.3