Jackson

Xml

Maven

<dependency>    
    <groupId>com.fasterxml.jackson.dataformat</groupId>
    <artifactId>jackson-dataformat-xml</artifactId>
</dependency>

Ignore unknown fields

   public void run(String... args) throws Exception {

        File file = ResourceUtils.getFile("classpath:config.xml");
        InputStream inputStream = new FileInputStream(file);

        XmlMapper xmlMapper = new XmlMapper();
        xmlMapper.enable(JsonGenerator.Feature.IGNORE_UNKNOWN);
        xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        Cruise cruise = xmlMapper.readValue(inputStream, new TypeReference<>() {
        });

        process(cruise);

        System.exit(0);
    }

For lists

Json

PropertyOrder

Property

Yaml

Maven

Setup mapper

Pretty print

Last updated