> @Nullable Optional<Boolean> foo;
To be (somewhat facetiously) fair, that's just JSON. The key can be not-present, present but null, or it can have a value. I usually use nested Options for that, not nulls, but it's still annoying to represent.
In Rust I could also do
enum JsonValue<T> {
Missing,
Null,
Present(T),
}
But then I'd end up reinventing Option semantics, and would need to do a bunch of conversions when interacting with other stuff.