AI basics & verificationPractical AI workflows

AI JSON passes Schema but is still wrong: verify a ticket against its source

A JSON object can pass validation while naming a person absent from its source. This complete T-007 ticket exercise provides the original text, Schema, three deliberately constructed outputs and a reference ledger. Follow validation, path querying and download checks. These are teaching materials, not claimed outputs from a particular model.

a computer screen with a bunch of code on it
Illustrative photo: Chris Ried · Unsplash License

What changed: Added source, Schema and three downloadable outputs, with validation, owner-path checks, downloaded-result review and a separate evidence ledger.

The workflow at a glance

Validate JSON syntax and the agreed structure, then compare every value with the original ticket. The second object names Mina: it passes this Schema but has no source evidence for that owner. Keep owner:null in this case. A validation pass or successful download does not perform the separate evidence review.

Define the agreement before asking for extraction

Our original source says: “Ticket T-007: User cannot export PDF. Product not identified. Owner unassigned.” Extract the ticket ID, issue category, owner and evidence. Categories are export, login and unknown; an unsupported owner is null. These are editorial task rules, not business requirements invented by a model.

The official JSON Schema object guide explains properties, required and additionalProperties. Use them to control structure while defining field meaning and accepted scope yourself. Permitting a property does not establish that its value was confirmed in the source.

Agreement for this example
FieldRequirementSource comparison
ticketIdT- followed by three digits, as a stringThe source says T-007, not the number 7.
categoryexport / login / unknownClassify the problem; urgency is not an issue category.
ownerRequired field, string or nullThe source assigns nobody, so use null here.
evidenceNonempty stringRetain an actual problem excerpt without invented facts.

Copy a Schema with explicit boundaries

This original simple Schema fits KitNelo’s Draft-07 validator. It rejects extra properties, requires four fields and checks the identifier, category and types. It does not query a ticket system or determine whether an owner’s name is supported.

To try extraction with AI, use the original prompt below and the same source agreement. Preserve the model’s raw response instead of silently cleaning it into a passing object before review.

Example Schema

{
  "type": "object",
  "properties": {
    "ticketId": {
      "type": "string",
      "pattern": "^T-[0-9]{3}$"
    },
    "category": {
      "enum": [
        "export",
        "login",
        "unknown"
      ]
    },
    "owner": {
      "type": [
        "string",
        "null"
      ]
    },
    "evidence": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "ticketId",
    "category",
    "owner",
    "evidence"
  ],
  "additionalProperties": false
}
For this editorial case only. Responsible owners must define actual task fields and business rules.

Original extraction prompt

Extract JSON from this source without adding facts.
Keep ticketId, category, owner and evidence.
category must be export, login or unknown; use null for owner without evidence.
Use an actual problem excerpt for evidence. Return JSON only, without extra fields.
Source: Ticket T-007: User cannot export PDF. Product not identified. Owner unassigned.
A prompt for readers to try, not a record of a model run performed for this article.

Three outputs need different acceptance decisions

The first constructed object uses numeric 7 for ticketId, urgent for category and an extra priority field, violating the agreement. The second fixes structure but retains owner: Mina, a deliberately unsupported name. The third changes owner to null, matching the unassigned fact in this example.

The second object is the important counterexample: a string owner is allowed, but the Schema cannot know whether Mina owns this ticket. The validator does not replace source reading, and a pass cannot overrule the original material.

Manually constructed test objects
ObjectStructural expectationEvidence acceptance
{"ticketId":7,"category":"urgent","owner":"Mina","evidence":"cannot export PDF","priority":"high"}Fails: extra property, identifier type and categoryThe unsupported owner also needs review.
{"ticketId":"T-007","category":"export","owner":"Mina","evidence":"cannot export PDF"}Passes this structural agreementMina lacks source evidence; reject that value.
{"ticketId":"T-007","category":"export","owner":null,"evidence":"cannot export PDF"}Passes this structural agreementMatches the ticket and agreed unknown-owner handling.

Run the validator, then return to the source

Open the JSON query and Schema tool. Use the separate JSON input and JSON Schema areas; the Schema is not another field inside the ticket. Paste schema.json, then inspect each candidate in the sequence below. Confirm the current candidate and input before every run so a previous response is not mistaken for the next result.

The result can be downloaded as json-result.txt. It is the validator’s text response, not a formal export of the ticket JSON or a human evidence certificate. Rename each downloaded response by candidate and retain the original JSON plus the independent review ledger.

  1. Paste invalid-syntax.json and run “Validate input”. Expect a JSON parsing error. Restore the correct input rather than deleting business fields to obtain a pass.
  2. Paste candidate one with the original Schema. Expect constraint errors concerning the extra priority field, ticketId type or category enum. Error order and wording may differ between validator versions.
  3. Paste candidate two and validate: it should pass. Query the JSON Pointer path /owner: expect the string “Mina”. Compare source.txt and record that this owner lacks evidence.
  4. Paste candidate three and validate against the same Schema: it should also pass. Query /owner for null, then /ticketId for the string “T-007”.
  5. Compare category export and the evidence fragment cannot export PDF with the source, while retaining owner:null. Record structural and evidence decisions separately in review-ledger.csv. Only candidate three is accepted in this exercise.
  6. Download the individual validator responses and reopen them against the candidate filenames. The response does not replace the source JSON; a single line saying pass cannot reconstruct the validated object.

A structural pass can still be rejected

Structure only

owner: "Mina", with an allowed string type

Matches this source

owner: null, matching Owner unassigned

A plausible name is insufficient. Keep structural validity and source support as independent records.

Keep uncertainty instead of repairing it into a pass

For ambiguous source text, unclear versions or undefined fields, retain uncertainty for the responsible person. One validation does not establish complete category coverage or cross-record relationships. Use the missing-versus-zero review to define unknown handling instead of filling fields with arbitrary zeroes, empty strings or names.

The tool supports Draft-07 with a combined limit of two million characters across input, comparison text and Schema. Validation runs locally. Separate syntax, Schema and business-evidence problems. Before table export, use the CSV and JSON conversion checks for identifiers and missing values; conversion cannot repair unsupported facts.

Before accepting structured output

  • Define fields and unknown handling, with a Schema matching the task version.
  • Pass syntax and structure checks while retaining raw errors and corrections.
  • Ground important values in the source; an allowed string is not a confirmed fact.
  • Keep unresolved items without inventing values to continue an automated flow.

Keep inputs, validator results and review decisions separate

The exercise ZIP contains source.txt, schema.json, output-01-invalid-structure.json, output-02-valid-unverified.json, output-03-source-aligned.json, invalid-syntax.json and review-ledger.csv. The three outputs retain the original article’s cases; invalid-syntax.json adds a syntax fault. The source establishes T-007, inability to export PDF, unidentified product and an unassigned owner.

These are three candidates for one ticket, not three real tickets to append to an operations report. Each ledger row describes review of one candidate. Keep the source, candidates, validator responses and acceptance decision under different filenames so a pass from candidate two cannot be mistaken for an evidence decision on candidate three.

Two validation passes and one accepted candidate

Two candidates pass the structure layer; only one is accepted against the source. These are three editorially constructed candidates, not a measured model accuracy of one third or two completed tickets. No model run was used to estimate how often the error occurs.

An absent owner field, an empty string and null are different states. required makes the field mandatory; the current owner type permits strings and null, so an empty string may still pass this Schema while violating the exercise’s explicit unknown-value convention. State a null-for-unknown rule in the review contract or a stricter Schema instead of inferring it from a green pass.

To recover, correct the unsupported value, rerun the original Schema and repeat the source comparison. Changing only the ledger to accepted while losing the final JSON does not produce a reviewable handoff. For later tabular conversion, use the CSV/JSON checking guide and account for distinctions that may collapse into blank cells.

Three candidates for one ticket, not three business records
CandidateStructureSource evidenceExercise decision
01FailsMina unsupportedReturn for structure and evidence correction
02PassesMina unsupportedDo not accept
03PassesT-007 / export / null / source fragment alignAccept this case; retain original JSON

Common questions

Can Schema verify that the owner is real?

It checks constraints and types. This example has no live ticket connection, so owner evidence must be reviewed against the source.

May an unknown owner field be omitted?

This agreement requires it, so use null. Real tasks must define unknown handling before leaving omission or naming decisions to a model.

Can I simply remove extra properties to pass?

First assess their business meaning. Removal may satisfy structure while losing information worth retaining elsewhere. Correct against an approved agreement and preserve the raw output.

Further reading & sources

Put the guide into practice

Open the relevant tool, preview the result and check your exported file.

Related articles