Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,378
Community Members
 
Community Events
184
Community Groups

How do I override Atlassian's instantiation of ObjectMapper?

David Maye
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Mar 18, 2020

We are developing an Atlassian Confluence plugin (starting with RefApp, because it is a lighter app to develop on) using the Atlassian REST API plugin module (atlas-create-refapp-plugin-module, option 7 or atlas-create-confluence-plugin-module, option 9). (The front-end is Angular, so we are relying on the Rest API for the whole app.)

I need to customize the Jackson ObjectMapper. Here are two related Atlassian Community posts that are unanswered/only partially answered:

https://community.developer.atlassian.com/t/can-i-customize-the-jackson-objectmapper/31069

https://community.atlassian.com/t5/Jira-Core-questions/How-to-customize-Jackson-ObjectMapper/qaq-p/242012

Here is what I want access to:

Jackson Serialization Features:
https://github.com/FasterXML/jackson-databind/wiki/Serialization-Features

Jackson Deserialization Features:
https://github.com/FasterXML/jackson-databind/wiki/Deserialization-Features

I have dug through the code of Atlassian's REST API module:

https://bitbucket.org/atlassian/atlassian-rest/src/master/atlassian-rest-module/src/main/java/com/atlassian/plugins/rest/module/

How do I override Atlassian's instantiation of ObjectMapper and register it with the appropriate modules so that I can use my own Jackson ObjectMapper settings?

2 answers

0 votes
Adrian Moerchen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 16, 2023

Just add Jackson as dependency and use it directly.

(Please note: don't let Bandana serialize your objects, use your own mapper then. Avoids many problems…)

pom.xml

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<!-- Jackson 2.15.0 may break with older Java -> test again, when with > 2.15.0 -->
<version>2.14.2</version>
</dependency>

Code

ObjectMapper objectMapper = new ObjectMapper();
0 votes
Kashev Dalmia _Soteri_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
Jan 04, 2022

@David Maye did you ever figure out how to do this?

It is just amazing how all the nitty-gritty questions are left unanswered.

I just consume the raw JSON string in my method and call my own object mapper.

Like Adrian Moerchen likes this

Suggest an answer

Log in or Sign up to answer