ip-jackson-databind

Provides support for serializing and deserializing IP addresses and ranges using Jackson. All you need to do is register a module. This can be done in two ways:

  1. Using MapperBuilder.addModule:

    JsonMapper mapper = JsonMapper.builder()
            .addModule(IPModule.instance())
            .build();
    
  2. Using MapperBuilder.findAndAddModules(). This will register not just an instance of IPModule, but any other module that's made available through the Service Provider Interface (SPI) mechanism:

    JsonMapper mapper = JsonMapper.builder()
            .findAndAddModules()
            .build();
    

No matter which way you choose, it will automatically allow all instances of IPAddress, IPRange and Subnet to be serialized and deserialized, without the need for any custom serializer or deserializer.