Tag: JSON

  • Jackson, JAXB, OpenAPI and Spring

    Imagine that you have a service that enriches some data. The model for the data that needs to be enriched is generated from an XSD. The model for the enriching data (the wrapper) is generated from OpenAPI specs. Those two separate models need to be combined and sent out via Spring’s RestTemplate. The problem is…

  • Java XML Api

    Who uses XML in 2021? We all use JSON these days, aren’t we? Well, it turns out XML is still being used. These code fragments could help get you up to speed when you’re new to the Java XML API. Create an empty XML document To start from scratch, you’ll need to create an empty…

  • Spring Boot, MongoDB and raw JSON

    Sometimes you want to store and retrieve raw JSON in MongoDB. With Spring Boot storing the JSON isn’t very hard, but retrieving can be a bit more challenging. Setting up To start using MongoDB from Spring Boot, you add the dependency to spring-boot-starter-data-mongodb And then you inject MongoTemplate into your class Inserting into MongoDB Inserting…