Skip to main content
Fills in any keys that are missing from the incoming array or object using a set of default values you supply. Anything already present in the input is kept as-is; only the gaps are filled from your defaults. Use this to guarantee that certain fields always exist, for example making sure every product carries a default colour, size, or material even when the source system left them out. The fill happens at every level, so nested objects are completed as well, not just the top-level keys.

Fields

Sample data

FieldValue
Array{ "color": "black", "size": "One size", "material": "cotton" }
Input:
{ "attributes": { "color": "red", "size": "M" } }
Output:
{ "attributes": { "color": "red", "size": "M", "material": "cotton" } }
The input already had color and size, so those are kept untouched. Only the missing material is filled in from the supplied defaults.