Skip to content

Conversation

elitwin
Copy link

@elitwin elitwin commented Sep 24, 2025

Many schemas are configured to not allow empty objects, arrays or NULL values.
When writing JSONata scripts to generate output, it can be challenging to write conditional logic that checks whether or not deeply nested arrays/objects actually have data to generate without creating a lot of duplicate logic checks.

The removeEmpty function allows you to wrap any block of JSONata code to recursively process the results and remove empty arrays, objects, null values and optionally, empty strings.

This Pull Request contains updates to the documentation as well as a comprehensive suite of tests.

Signed-off-by: Eric Litwin [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant