All guides

Original explainer

n8n Edit Fields: define an output contract for AI workflows

Use Edit Fields to define field names, types and retained data, then inspect nesting before downstream processing.

AI Nav CityWritten / Updated Sources checked

Before an AI classification result reaches a spreadsheet or database, it needs a stable shape. This guide prepares a synthetic record containing only ticket_id, category and score. You need access to a workflow editor and a sample without private data. The documented options and an offline contract were checked; n8n was not operated.

Action and acceptance sequence

  1. Define fields

    List the names and types the next step reads.[1]

  2. Configure mapping

    Specify fields and values using Manual Mapping or JSON Output.[1]

  3. Inspect output

    Check extra fields, number types and nesting produced by dots.[1]

Check each stage separately; the final section states execution scope.

Write an acceptance table

Original exercise: ticket_id is demo-17, label is billing, confidence is the number 0.8, and debug is an extra field. Rename label to category and confidence to score while retaining ticket_id. Record the names and types first; debug should not reach the final record. These values are synthetic and do not demonstrate model accuracy.[1]

Choose mapping and retention

Add Edit Fields (Set) and select Manual Mapping. The documentation says dragging from INPUT creates an expression referencing the value. Switch literal text to Fixed where appropriate. JSON Output is another way to define the object. Review retention through Keep Only Set Fields or Include in Output in your interface, then inspect the result rather than assuming the mode removed original fields.[1]

Check numbers and dotted names

Confirm score remains a number rather than a string. Ignore Type Conversion Errors can ignore some mapping type errors; avoid using it to hide a contract violation. Dot notation is supported by default: result.score creates a nested object. If the next step needs a literal dotted key, review Support Dot Notation. Both structures can be valid JSON but require different access paths.[1]

Verify output and stop conditions

Check the field set, types and original ID. Stop downstream writes when a field is missing, a type differs or nesting is unexpected, and inspect the mapping. An offline check validated the synthetic object field set and number type. No node, database, model or saved workflow was used. When adopting it, run a disposable sample first and inspect the record received downstream.[1]

Article sources

Original editorial content; official descriptions and checking suggestions are distinguished.

  1. n8n · Official sources
    View details