FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login
    1. Home
    2. brian_ls
    3. Best
    B
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 4
    • Best 1
    • Controversial 0
    • Groups 0

    Best posts made by brian_ls

    • RE: Deserializing webhook events in java

      @brian_ls I figured this out and wanted to put my solution here in case it's useful to someone.
      There are 2 issues with the event string. First is that it is wrapped with an outer {}, and second it is wrapped with another outer field called 'event'. So I had to deal with each issue separately. I created a simple wrapper class:

      public class BaseEventWrapper {
      BaseEvent event;

      public BaseEvent getEvent() {
      	return event;
      }
      

      }

      So when I deserialize, I do so into this class. This takes care of the 'event' element. To remove the outermost {}, I set a property in the ObjectMapper, which all together looks like this:
      ObjectMapper mapper = new ObjectMapper().registerModule(new JavaTimeModule());
      mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
      BaseEvent event = mapper.readValue(newEvent, BaseEventWrapper.class).getEvent();

      Enjoy 🙂

      Brian.

      posted in General Discussion
      B
      brian_ls