After deletion, if compact is true and there is an empty object or array left, the empty object or array is also removed
However, if the path that is given does not exist, no compaction of the parents is done.
For example, given the VRL program del(.foo.bar, compact: true) and an input object of {"foo": {"bar":true}}, the result is an empty object. However, with an input object of {"foo": {}}, the result is unchanged, even though the implication is that "foo" would be compacted.
When using
del
withcompact: true
, the docs say:However, if the path that is given does not exist, no compaction of the parents is done.
For example, given the VRL program
del(.foo.bar, compact: true)
and an input object of{"foo": {"bar":true}}
, the result is an empty object. However, with an input object of{"foo": {}}
, the result is unchanged, even though the implication is that"foo"
would be compacted.