Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9288013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:49:05+00:00 2026-06-18T19:49:05+00:00

When RESTeasy marshals a POJO into XML, it will skip null values by default.

  • 0

When RESTeasy marshals a POJO into XML, it will skip null values by default.

However, when marshaling to JSON, null properties are included. Is there any way to force the JSON output to match the XML output?

Also i tried @XmlElement(required=false, nillable=true)) and it’s not worked. I’ve been used only RESTeasy with Annotations.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T19:49:06+00:00Added an answer on June 18, 2026 at 7:49 pm

    Use Jackson 2. Setup the following provider:

    package com.recruitinghop.swagger;
    
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.ext.Provider;
    
    import com.fasterxml.jackson.annotation.JsonInclude;
    import com.fasterxml.jackson.databind.DeserializationFeature;
    import com.fasterxml.jackson.databind.ObjectMapper;
    import com.fasterxml.jackson.databind.SerializationFeature;
    import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
    import com.fasterxml.jackson.module.scala.DefaultScalaModule;
    
    @Provider
    @Produces(MediaType.APPLICATION_JSON)
    public class JacksonJsonProvider extends JacksonJaxbJsonProvider {
    
        public JacksonJsonProvider() {
              ObjectMapper mapper = new ObjectMapper();
              mapper.registerModule(new DefaultScalaModule());
              mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
              mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
              mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
              mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
              super.setMapper(mapper);
        }
    
    }
    

    The Scala module is optional.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to add links to my resteasy api xml and json output. So
I'm using RESTeasy to convert a json from the payload to a POJO in
I am using RestEasy to marchal entities to JSON. That works okay but somehow
I use jackson (via resteasy) to convert json to a Java object. I've only
code on: JBoss 7.1.1.Final, JEE6, JSF2, using resteasy oauth: on web.xml: <context-param> <param-name>oauth.provider.provider-class</param-name> <param-value>com.ostudio.dbo.rest.OAuthMyProvider</param-value>
I'm using RESTEasy to send objects over my rest api with JSON. It's very
My service side code is implemented using Resteasy @GET @Path(/ad-details/{query}) @Produces(application/json) public String getAdDetails(@PathParam(query)
I'm using RESTEasy to return Java objects as JSON objects (which is using Jettison
I've created very simple REST app with next web.xml: <context-param> <param-name>resteasy.scan</param-name> <param-value>true</param-value> </context-param> <listener>
I produce json using resteasy. Everything works fine but... I can't order the parameters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.