cancel
Showing results for 
Search instead for 
Did you mean: 

Removing Null Values from JSON

manchis
New Contributor

Hi,

We have a requirement to remove the null values elements from the json. Below is the example JSON which is having null values at Root and child levels. We need a solution to remove nulls at all levels and if all elements in child are removed then the entire child should get remove.

Could you please provide the pipeline solution for it.

Example:
{
“Root”:{
“Element1”:“1”,
“Element2”:“A”,
“Element3”:null,

“Child1”:{
“Element4”:“1”,
“Element5”:null
}

“Child2”:{
“Element6”:“1”,
“Child3”:{
“Element7”:“1”,
“Element8”:null,
“Child4”:{
“Element9”: null
}
}
}
}
}

Expected Result:

{
“Root”:{
“Element1”:“1”,
“Element2”:“A”

“Child1”:{
“Element4”:“1”
}

“Child2”:{
“Element6”:“1”,
“Child3”:{
“Element7”:“1”
}
}
}
}

2 REPLIES 2

SpiroTaleski
Valued Contributor

@manchis

I think that the expression from the below post will help you to achieve the desired output:

Regards,
Spiro Taleski

manchis
New Contributor

@Spiro_Taleski - Thank you! Yes I checked this article and it worked.