Skip to main content

Remove empty fields from JSON

Remove all fields with empty values from a provided JSON. An empty field is one that has the value `None`, `null`, or `''`. `false` is a non-empty value and will be returned.

Application

  • Text

Inputs (what you have)

NameDescriptionData TypeRequired?Example
Original JSONThe JSON you would like to remove fields with empty values fromText (Long)Yes{“field1”:”value1”,“field2”:””}
Remove empty lists?Remove fields with empty lists [] as values?True or FalseNo
Remove empty items from lists?Remove null, {} and '' items from any arrays in the JSON?True or FalseNo
Remove empty objectsRemove fields with empty objects {} as values?True or FalseNo

Note: the value of inputs can either be a set value in the configuration of the Wrk Action within the Wrkflow, or a variable from the Data library section. These variables in the Data library section are the outputs of previous Wrk Actions in the Wrkflow.

Outputs (what you get)

NameDescriptionData TypeRequired?Example
Non-empty JSONJSON that has had empty values removedText (Long)Yes{“field1”:”value1”}

Outcomes

NameDescription
SuccessThis status is selected if all empty values are removed from the JSON
UnsuccessfulThis status is selected in the event of the following scenarios:Original JSON is not in JSON format