Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.crunc:jackson-datatype-vertx:'
}
dependencies {
implementation("com.github.crunc:jackson-datatype-vertx:")
}
<dependency>
<groupId>com.github.crunc</groupId>
<artifactId>jackson-datatype-vertx</artifactId>
<version></version>
</dependency>
libraryDependencies += "com.github.crunc" % "jackson-datatype-vertx" % ""
:dependencies [[com.github.crunc/jackson-datatype-vertx ""]]
Jackson2 Module which allows reading/writing io.vertx.core.json.JsonObject
<repositories>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependency>
<groupId>de.crunc</groupId>
<artifactId>jackson-datatype-vertx</artifactId>
<version>2.1-SNAPSHOT</version>
</dependency>
ObjectMapper mapper = new ObjectMapper();
ObjectMarshaller marshaller = new ObjectMarshaller(mapper);
SamplePojo pojo = new SamplePojo("Foobar");
JsonObject json = marshaller.marshall(pojo);
ObjectMapper mapper = new ObjectMapper();
ObjectMarshaller marshaller = new ObjectMarshaller(mapper);
JsonObject json = new JsonObject();
json.putString("message", "Hello pojo");
SamplePojo pojo = marshaller.unmarshall(json, SamplePojo.class);
ObjectMapper mapper = new ObjectMapper();
om.registerModule(new VertxJsonModule());
String jsonObject = mapper.writeValueAsString(new JsonObject());
String jsonArray = mapper.writeValueAsString(new JsonArray());
ObjectMapper mapper = new ObjectMapper();
om.registerModule(new VertxJsonModule());
JsonObject object = mapper.readValue("{}", JsonObject.class);
JsonArray object = mapper.readValue("[]", JsonArray.class);