JSON apply defaults

Client

Fill missing keys from a defaults object without overwriting existing values—shallow or deep nested objects. Unlike deep merge, this never replaces data already present.

Learn more: filling missing keys

Merge a defaults template into JSON objects by adding keys that are absent—existing values are never replaced.

Versus deep merge

Deep merge overlays values from a second document, including nested replacements. Defaults only supplies keys that are missing at each level you enable.

Arrays

When a key exists but holds an array, the defaults array is not merged element-by-element—it is used only when the key is entirely absent.

Nearby workflows on Toolcore

  • JSON deep mergeMerge two objects recursively—right overlays left; dual JSON prefill. once JSON text parses on this page.
  • JSON cleanerRemove null and optional empty values recursively—pretty-printed output; local only. once JSON text parses on this page.
  • JSON pick or omit keysKeep or drop top-level keys on an object or array of objects—case-sensitive; local only. once JSON text parses on this page.
  • JSON formatterJSON format online: pretty-print, minify, validate, escape, download . once JSON text parses on this page.

Apply JSON defaults

?

Only missing keys are added—existing values are never overwritten. Deep mode walks nested objects; arrays are not merged element-wise.

Filled 3 missing keys.

Common use cases

  • Add default flags to API rows after stripping unknown fields.
  • Normalize import batches where some records omit optional metadata.
  • Seed nested meta objects without clobbering values already present.

Common mistakes to avoid

  • Expecting overwrites

    Existing keys stay as-is. Use deep merge when the overlay should replace values.

  • Applying defaults to arrays inside objects

    Arrays copy from the template as whole values—elements are not merged item-by-item.

FAQ

Deep vs top level?

Deep walks nested objects and fills missing inner keys. Top level only touches root properties.

Array of objects?

Yes—the same defaults template applies to every object in a root array.

Common search terms

Phrases people search for that match this tool. See the full long-tail keyword index.

  • json apply defaults
  • fill missing json keys
  • json default values merge

Related utilities you can open in another tab—mostly client-side.