In this post, we will see how to resolve Removing null keys from a json array of objects
Question:
I am pulling policies from an azure keyvault
Which returns some data like
Somehow I need to filter out the null permission objects, either by completely removing them or by replacing them with empty arrays. There could be any combination of policies. Is it possible to filter these out? I’ve been trying variations of jmespath and jq for hours and getting nowhere.
Best Answer:
You’re looking for something like this:
Online demo
If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com