Building a Simple CLI Tool with Picocli

Picocli is a small Java library that makes it easy to build command-line tools. You write plain Java classes, add a few annotations, and Picocli handles parsing, help text, and error messages for you. Why build a CLI tool? Many useful tools run in the terminal: Build scripts Data migration utilities Dev helpers (rename files, check configs, seed databases) Internal admin tools You can parse args manually with String[] args, but that gets messy quickly when you need flags, subcommands, defaults, and --help. ...

June 20, 2026

Dealing with Java and JSON conversion

When you are trying to convert any java object to json, you may run in to this problem. com.fasterxml.jackson.core.JsonGenerationException: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) This is due to null key in the map of objects (or collection of objects). JsonGenerator cannot serialize the null key into json. Ignore ’null’ values in the map So we can ignore ’null’ key and values from the ObjectMapper by using: ...

September 23, 2016