-Scenario | Ballerina Representation | Current Behavior | Expected Behavior
--- | -- | -- | --
-Required & non-nullable | T foo; | Both null values and absent fields cause runtime failures | Same
-Required & nullable | T? foo; | Absent fields will cause runtime failures | Need relaxed data binding to map absent fields as nil values
-Optional & non-nullable | T foo?; | Null values will cause runtime failures | Need relaxed data binding to map null values as absent fields
-Optional & nullable | T? foo?; | Both nil values and absent fields are allowed | Same
-
-
+| Scenario | Ballerina Record Field Representation | Default Behavior | Relaxed Behavior |
+|-------------------------|---------------------------------------|-----------------------------------------------------------|---------------------------------------------------------------|
+| Required & non-nullable | `T foo;` | Both null values and absent fields cause runtime failures | Same |
+| Required & nullable | `T? foo;` | Absent fields will cause runtime failures | Need relaxed data binding to map absent fields as nil values |
+| Optional & non-nullable | `T foo?;` | Null values will cause runtime failures | Need relaxed data binding to map null values as absent fields |
+| Optional & nullable | `T? foo?;` | Both nil values and absent fields are allowed | Same |
In the `data.jsondata` package, the `Options` configuration already provides support for handling various field types in JSON data binding, accommodating scenarios with both absent fields and null values. The `Options` record allows us to adjust how nullability and optionality are treated, making it a versatile solution for managing the differences between required and optional fields, as well as nullable and non-nullable fields.