We have updated our Terms of Service, Code of Conduct, and Addendum.

How to remove the null elements of an array

I have some JSON that I've extracted via a parser function, manipulated/renamed some fields, and now I have an element of an array that is null. Can anyone point me in the right direction on how I might clean up the null? For reference, my end destination is a GCP storage bucket, so I'm just writing the data out as a raw JSON string. It seems I can serialize the fields back into _raw (which cleans up the null array element), and then extract again, and then remove _raw, but that feels like it is potentially inefficient, 3 step process. Is there a better way to accomplish this?

Answers

  • Try a Parser() function at the end of the Pipeline. Type=JSON Object Source field=`_raw` Destination field=`_raw` Fields Filter Expression=`value != ''`