I am trying to create a JSON. When there are empty fields I am using the ignore function. If all fields are empty in a collection it should be removing the collection but it is not. How do I remove all of the empty fields at the end of the JSON?
It is returning like this:
{“entities”:[{“index”:1,“entity”:“customer”,“fields”:[{“name”:“email”,“value”:null},{“name”:“first_name”,“value”:null},{“name”:“last_name”,“value”:null},{“name”:“full_address”,“value”:" "},{“name”:“date_of_birth”,“value”:null},{“name”:“gender”,“value”:null},{“name”:“marital_status”,“value”:null}]},{“index”:1,“entity”:“Car”,“fields”:[{“name”:“year”,“value”:“2020”},{“name”:“make”,“value”:“Honda”},{“name”:“model”,“value”:“Civic”}]},{“fields”:[{},{},{}]},{“fields”:[{},{},{}]}]}