Skip to main content
All CollectionsWrk Action LibraryText
Remove empty fields from JSON
Remove empty fields from JSON
Wrk Product avatar
Written by Wrk Product
Updated over 8 months ago

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)

Name

Description

Data Type

Required?

Example

Original JSON

The JSON you would like to remove fields with empty values from

Text (Long)

Yes

{“field1”:”value1”,

“field2”:””}

Remove empty lists?

Remove fields with empty lists [] as values?

True or False

No

Remove empty items from lists?

Remove null, {} and '' items from any arrays in the JSON?

True or False

No

Remove empty objects

Remove fields with empty objects {} as values?

True or False

No

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)

Name

Description

Data Type

Required?

Example

Non-empty JSON

JSON that has had empty values removed

Text (Long)

Yes

{“field1”:”value1”}

Outcomes

Name

Description

Success

This status is selected if all empty values are removed from the JSON

Unsuccessful

This status is selected in the event of the following scenarios:

  • Original JSON is not in JSON format

Did this answer your question?