Skip to content

vavr-io/vavr-jackson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8f543c8 · Mar 2, 2025
Mar 2, 2025
Dec 26, 2019
Mar 2, 2025
Oct 13, 2024
Nov 12, 2017
Sep 19, 2017
Oct 13, 2024
Oct 13, 2024
Mar 2, 2025
Jun 30, 2020
Jun 30, 2020
Nov 1, 2017

Repository files navigation

vavr-jackson

Build Maven Central Coverage Status

Jackson datatype module for Vavr library

Stargazers over time

Usage

Maven

<dependency>
  <groupId>io.vavr</groupId>
  <artifactId>vavr-jackson</artifactId>
  <version>0.10.3</version>
</dependency>

Gradle

compile("io.vavr:vavr-jackson:0.10.3")

Registering module

Just register a new instance of VavrModule

ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new VavrModule());

Serialization/deserialization

String json = mapper.writeValueAsString(List.of(1));
// = [1]
List<Integer> restored = mapper.readValue(json, new TypeReference<List<Integer>>() {});
// = List(1)

Using Developer Versions

Developer versions can be found here.

Maven

<dependency>
  <groupId>io.vavr</groupId>
  <artifactId>vavr-jackson</artifactId>
  <version>1.0.0-SNAPSHOT</version>
</dependency>

Ensure that your ~/.m2/settings.xml contains the following:

<profiles>
    <profile>
        <id>allow-snapshots</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <id>snapshots-repo</id>
                <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                <releases>
                    <enabled>false</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
    </profile>
</profiles>

Gradle

compile("io.vavr:vavr-jackson:1.0.0-SNAPSHOT")

Ensure that your build.gradle contains the following:

repositories {
    mavenCentral()
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
}