ModelWorks logoModelWorks
JSON TransformObject

omit

Remove the specified keys from an object

omit

Returns a new object with every top-level key listed in keys removed.

Options

OptionTypeRequiredDefaultDescription
keysarray<string>YesTop-level keys to remove.

Example

Input

JSON
{ "id": 1, "name": "Ada", "secret": "shh" }

Operation

JSON
{ "type": "omit", "options": { "keys": ["secret"] } }

Output

JSON
{ "id": 1, "name": "Ada" }

In a Circuit Step

JSON
{
  "name": "strip_secrets",
  "description": "Drop sensitive fields before persisting the user record",
  "function": "circuit.core.transform.json",
  "input": {
    "source": "${{ user }}",
    "operations": [
      { "type": "omit", "options": { "keys": ["secret", "password_hash"] } }
    ]
  },
  "outputs": [
    {
      "name": "safe_user",
      "description": "User object with sensitive fields removed",
      "value": "${{ strip_secrets.output.transformed_result }}"
    }
  ]
}

Notes & gotchas

  • Errors with omit: expected object if the input is not an object.
  • Keys that aren't present are silently ignored.
  • For nested removals, use unset (which supports dot-paths).
  • Output preserves the input key order minus the omitted entries.
On this page

On this page