When AI writes JSON, one bad field can break the workflow

Illustrated infographic summarizing: When AI writes JSON, one bad field can break the workflow

By Greg Nowak. Updated 15 November 2026.

An AI workflow reads an enquiry and prepares a CRM update. The response contains every required field, and the customer ID has the right format. There is just one problem: it identifies a different customer.

A JSON parser will accept that response. Your business should not.

For business owners, operations leads, and agency teams, the practical question is what stands between an AI suggestion and a live change. Structured outputs help software process a model’s response. Reliable automation also needs evidence, permissions, and a clear recovery path when something goes wrong.

What structured outputs actually guarantee

JSON Schema describes the expected fields, types, and allowed values. A provider’s structured output feature constrains generation to its supported schema rules, reducing failures such as missing fields or text where a number is expected.

The exceptions still matter. Claude’s current documentation explains that refusals and token limits can produce output that does not match the schema. A refusal can arrive with HTTP status 200, so checking the status code alone is insufficient. Inspect the completion reason before using the payload.

The same documentation notes that SDK helpers may remove unsupported constraints before generation, while helpers that validate responses check the original schema afterwards. It also documents an enum capitalisation caveat. Validate against the receiving system’s exact values; if you allow normalisation, map explicitly to an unambiguous canonical value.

Put five checks between the model and the write

Use this table in a project brief or integration review. Each failed check should lead to a defined next step.

Check What must be established If it fails
Response Generation completed without refusal or truncation Classify the failure before proceeding
Schema Required fields, types, and allowed values are valid Reject or attempt a bounded repair
Business rules The record matches and the proposed change makes sense Retrieve evidence or request review
Authority The action is permitted within the correct account Deny the action or obtain required approval
Execution Duplicate protection and downstream confirmation exist Reconcile uncertain outcomes before retrying
A valid payload is one checkpoint in a workflow that changes business records.

Define fields around the system receiving them

Start with the CRM, CMS, or support API. If priority accepts low, normal, and urgent, use those exact values in an enum. For money, define currency, units, precision, and tax treatment.

Listing a property does not make it mandatory. Use required explicitly and additionalProperties: false where unexpected fields must be rejected. The JSON Schema object reference also distinguishes a missing property from one containing null.

Agree what missing, null, and empty values mean for updates. Does an absent phone number leave the existing number untouched? Does null clear it? Encode that mapping explicitly rather than passing the model’s object straight to an update endpoint.

Dates require similar care. JSON Schema’s format is an annotation by default; enforcement depends on the validator and configuration, as the format reference explains. Enable supported checks, parse dates in application code, and define timezone and scheduling limits. Version the schema with the consuming code.

Resolve the customer before changing the customer

A correctly formatted customer_id proves little. The application should establish that the record exists, belongs to the authorised account, and matches the enquiry. Two plausible matches should create a review task.

Let the model extract a requested service, summarise a message, or suggest priority. Retrieve ownership, permissions, and payment status from authoritative systems. For agencies sharing infrastructure across clients, enforce account boundaries in application code and limit the integration’s credentials to the actions it needs.

Incoming documents and emails also remain untrusted. OWASP’s prompt injection guidance describes how instructions in external content can redirect model behaviour. An email saying “approve this change” must not grant approval.

For consequential actions, show the reviewer the target record and proposed changes. Bind approval to that exact proposal, then recheck permissions and record state before execution. If relevant information has changed, require a fresh decision.

Repairing JSON and retrying a write need different rules

An invalid date may justify one repair attempt with a precise validation error. An ambiguous customer needs evidence. A denied permission remains denied. Limit repair attempts, minimise personal data in error feedback, and run every check again afterwards.

A timeout after sending a write is different: the receiving system may already have completed it. Preserve the validated payload and operation identifier. Asking the model to generate another version can turn recovery into a different operation.

Where supported, use an idempotency key to identify repeated attempts at the same operation, keeping the key and request parameters stable. Check the API’s retention and failure behaviour. For example, Stripe documents different idempotency behaviour for API v1 and v2. Without suitable duplicate protection, reconcile the downstream result before repeating the write.

Make the exceptions workable before launch

Begin with a preview that shows proposed changes without applying them. Test unknown IDs, missing values, conflicting dates, denied actions, duplicate requests, timeouts, and instructions embedded in source content. Include a record that changes between preview and execution.

Give unresolved cases a named owner and a useful explanation. “Two customers match this enquiry” tells an operator what to resolve; “validation failed” leaves them investigating from scratch.

Record a correlation ID, model and schema versions, validation outcome, retry count, and confirmed execution result without collecting unnecessary sensitive data. Review recurring failures before expanding automation. Also define who can pause writes and how incorrect changes will be corrected.

Bring one workflow to the review

Greg can help review an existing integration or turn these decisions into an implementation brief your team can build from. Bring a representative payload, the receiving system, and the action you want to automate. Discuss your AI workflow with Greg to work through validation, approvals, and recovery before enabling live writes.

Related on GrN.dk

Need help with this kind of work?

Discuss your AI workflow with Greg Get in touch with Greg.

Sources

Latest articles

At month-end, reconcile Shopify Payments against your bank statement and e-conomic. Use the payout ID to trace fees, refunds, and payouts that reach your bank the following month.

Trace an intermittent NGINX 502 through Cloudflare, upstream attempts, and application logs so you can see where the request failed and who should pick it up.

Find the apps, scripts and printers that still send mail through Microsoft 365 with a mailbox password, then test a replacement before the December 2026 change.

Find subscriptions and insurance expenses in e-conomic that should be spread over several months. See how AI reads the supporting documents and how your finance lead approves the proposed allocations.

Before relying on an AI project briefing, check which files it covered. A practical workflow for tracking documents, recording gaps and verifying key claims.

Check whether your contact form rejects missing or invalid Turnstile tokens, handles failed checks for genuine users and delivers accepted enquiries to your team.

Compare Bing citations, identifiable AI visits and verified enquiries to see which pages deserve attention before you increase your AI search marketing budget.

Teamtailor is phasing out Riminder on 21 November 2026. Check your parser settings, contact fields and integrations, and make sure you have a process for deleting applicant data.

WordPress jobs running late? Learn how to separate scheduling problems, task errors and a growing backlog, then choose the right scheduler or runner.

Before changing an AI workflow, check that it still does the job. Use realistic examples, clear release criteria and a comparison with the version running today.