How to remove null values using JOLT?
[
{
"age_restrictions": "0+",
"autobidding_mode": "second_price",
"banner_uniq_shows_limit": null,
"budget_limit": 100,
"budget_limit_day": null,
"conversion_funnel_id": null,
"date_end": "2024-02-29",
"date_start": "2024-01-11",
"documents": [],
"dooh_settings": null,
"enable_clickid": true,
"enable_offline_goals": false,
"enable_utm": false,
"event_limit": null,
"from_export_vkcom": false,
"interactions": [],
"interface_read_only": false,
"language": "ru",
"marketplace_app_client_id": null,
"max_price": "0.00",
"mixing": "recommended",
"name": "Rec_site_video_test",
"objective": "branding_universal_banner",
"package_id": 3509,
"panel_id": null,
"price": "70.00",
"read_only": false,
"social": false,
"uniq_shows_limit": 5,
"uniq_shows_period": "month",
"utm": null
}
]
I know about function =recursivelySquashNulls
and it works okay. But what if I need to remove null values only for specific fields? I need to remove NULLs for (sometimes these fields are not null, so I need to be careful): panel_id,marketplace_app_client_id,dooh_settings
You can use the following transformation in order to remove those attributes if they have null values
[
{
"operation": "shift",
"spec": {
"*": {
"panel_id|marketplace_app_client_id|dooh_settings": {
"": { "*": "" },
"*": { "@1": "&2" } // non-nulls from the determined set
},
"*": "&" // other elements
}
}
}
]