- Merge request !26Views REST Export JSON output inconsistency for boolean fields when fields are... → (Open) created by someshver
When using Views REST Export in Drupal 11 with JSON output format, selecting multiple content types that include fields which are present in some content types but not others leads to inconsistent serialization behavior. Specifically,
for boolean fields (e.g., a boolean field named "is_accessible" present in the "article" content type but absent from the "page" content type), the JSON output shows true/false values for entities where the field is defined (e.g.,
articles), but returns an empty string ("") for entities where the field is missing (e.g., pages). This inconsistency affects data consumers expecting uniform boolean values, such as false in cases where the field is absent or
undefined, which breaks API reliability and predictability.
Modify the Views REST Export serialization logic to treat missing boolean fields as falsy by default. Specifically, update the field output to return false (or the appropriate boolean equivalent) when a boolean field is not present on an entity, rather than serializing it as an empty string. This could be implemented in the REST export plugin or through a Views field handler override, ensuring consistent output across multi-content-type Views. The change should be configurable or at least maintain backward compatibility where possible.
Active
3.1
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.