Data values can be “optional” - the meaning of this varies in practice depending on the implementation language, but in JavaScript these are generally serialized as null
.
Optionals are denoted by the suffix ?
.
Some languages, like Rust and Swift, have a concept of monadic nestable optionals implemented with sum types. This is extremely powerful and robust, but unfortunately does not map directly to JSON which only has a single null
value. We are exploring the implications of this idea and tracking it in Unions & Monadic Optionals.