Published October 28, 2026 · Independent educational guide
Read JSON Pointer Locations Before Asking AI to Extract a Value
An AI extraction task can fail before any calculation begins if the instruction points to the wrong value. A request to read the count inside the first item sounds clear until the document contains several arrays, repeated field names at different levels or a literal slash inside a key. A precise location expression can help describe the intended value. It still needs the correct document and an explicit interpretation contract.
This guide uses JSON Pointer string-form locations and six original fictional document groups. It distinguishes a path's spelling, the structure traversed and the value actually selected. No client JSON, provider response, API call, model output or destination update was inspected. The downloadable CSV contains authored inputs and manually stated expectations. Local checks compare those supplied examples only; they are not a general JSON Pointer implementation, security review or conformance test suite.
Agree on the location language before interpreting a path
RFC 6901 defines JSON Pointer. Its limited rules relevant here are these: tokens follow slash separators; within a token, ~1 represents slash and ~0 represents tilde; decode ~1 before ~0. The empty pointer selects the root. Object names match exactly without Unicode normalization. Array locations use zero-based indices without leading zeros. Missing targets fail evaluation; application error handling needs its own definition. This guide uses the string form, not URI-fragment syntax or a provider-specific path language.
Do not infer that an unfamiliar interface accepts JSON Pointer because an example contains slashes. A path-like string may belong to another language or be an ordinary field value. Ask what syntax the actual task uses before translating it. The expressions in this guide are explicitly declared JSON Pointer strings for authored examples. No interface was queried to discover or validate its accepted syntax, and no surrounding URL was fetched.
A practical instruction pairs the location with an identified document snapshot and expected kind of value. For example, the instruction might request the count at a supplied pointer in example document EX-DOC-A. The document label identifies the teaching object; the pointer identifies a location within it. Neither the label nor the expression establishes that a real customer record exists. If the snapshot changes, recheck the location rather than treating its previous meaning as permanent.
Keep selection separate from judgment. Finding a numeric value at a precise path does not establish that the value is accurate, current or approved for use. A selected field can still require a unit, a denominator or a source explanation. The existing JSON-contract and missing-state guides address those other questions. This guide focuses on location so that a later interpretation can begin with the intended supplied value instead of an accidental neighbor.
Case A: a slash inside a key is different from a separator
Case A authors an object with two branches. One top-level key is the literal text route/label and holds the value outer. A separate top-level key route holds an object whose label member is inner. The pointer /route~1label selects outer. The pointer /route/label selects inner. Both values exist in the supplied document, which makes this a useful counterexample: a wrongly spelled location can select a plausible value without producing a missing-target error.
The problem is not resolved by saying that the names look almost the same. One expression names a single key containing a slash; the other traverses two keys at two levels. Preserve that distinction in the extraction request and the result. A reviewer should be able to see the exact pointer used and the value it selected. A prose explanation that says the label was read hides the difference that matters in this example.
A useful AI drafting task asks the assistant to explain which supplied structure each expression refers to. It should not ask the assistant to choose which value a business intended without additional context. In the authored document, outer and inner are deliberately different labels. Neither is a real destination or a correct customer answer. The check demonstrates the consequence of the two locations, while the intended business location remains a separate instruction from the task owner.
When reviewing a real task, first reproduce the smallest relevant structure with its key names intact. Do not rename a key to make the explanation look cleaner. A renamed example may erase the very slash that caused the ambiguity. If you simplify unrelated fields, say that the example is a selected structure rather than the whole source document. That keeps the explanation useful without turning a small selection check into a claim of complete document coverage.
Case B: decode the tilde sequence once in the stated order
Case B authors keys tag~name, ~1 and /, with values T, literal-sequence and slash-key respectively. The pointer /tag~0name selects T. The pointer /~01 selects literal-sequence, because its token becomes the literal text ~1 under the stated decoding order. It does not become slash. The pointer /~1 selects slash-key. These three authored outcomes make it possible to see why repeatedly replacing escape-looking text would change the selected target.
Do not keep decoding a token until it stops looking encoded. That would introduce an additional operation that the example does not declare. The token ~01 contains characters whose transformation is bounded by the location syntax. A second opportunistic transformation can turn a literal key spelling into a different key. When an assistant explains the path, require it to retain the intermediate token meaning rather than compressing the reasoning into a vague claim that escapes were handled.
This is a representation issue within the location expression, not a request to change the source object's keys. The authored key ~1 remains a key named ~1. A correctly selected value does not authorize rewriting that key to /. If a real application intends to migrate or rename fields, it needs a separate change specification and authority. The examples here perform selection checks only and never write a modified document to a destination.
For a handoff note, quote the pointer and the selected key separately. That small separation helps a colleague distinguish the spelling used to address the value from the spelling present in the document. It also makes a disagreement reproducible: both people can compare the same supplied token transformation. The local check verifies these particular strings and results, not every valid escape, invalid escape or resource limit that a general parser would need to handle.
Case C: array positions and object names need different readings
Case C supplies an items array containing two fictional objects, EX-A then EX-B. It also supplies a separate object codes with a key named 01 holding object-code. The pointer /items/0/id selects EX-A, and /items/1/id selects EX-B. The attempted array token 01 in /items/01/id is not accepted by the declared array-index rule. The object pointer /codes/01 selects object-code because that token is a literal object member name in this supplied structure.
The characters 01 therefore cannot be interpreted without knowing the current container. A request that says read element 01 leaves out that important context. Do not convert every numeric-looking key into an integer before traversing the document. That would impose an unrequested transformation on object names. The existing numeric-reference-code guide discusses spelling and type; this example preserves that separate owner while showing how container structure affects location interpretation.
A position is also not a stable business identifier. If a later authored snapshot reverses the two items, the pointer /items/0/id selects EX-B in that new snapshot. The pointer's spelling is unchanged while its selected value changes because the array order changed. This is not a real identity finding or a defect diagnosis. It illustrates why an extraction note should name the snapshot instead of treating the first array entry as a permanent reference to an entity.
If the task requires the object whose id equals EX-A, say so as a separate selection requirement rather than pretending that its current position is its identity. A search or filter would need its own rules for absent or repeated identifiers. JSON Pointer alone addresses a supplied location. This guide does not implement a record search, resolve duplicates or decide which of several matching business records should be used in a production workflow.
Case D: an empty pointer is different from an empty key
Case D authors the object whose empty-string key holds 7 and whose note key holds EX-NOTE. The empty pointer selects the complete supplied object. The pointer / selects the value 7 at the empty-string key. These are two different selections. The empty pointer has zero characters; / has one. The example prevents a seemingly harmless cleanup step from turning a root selection into a member selection or treating both as missing instructions.
Keep the pointer's exact string visible when its length is meaningful. In a table or message, an empty cell can be ambiguous: it might mean an empty pointer, a missing value or an unfilled form. A good teaching representation explicitly labels the empty string and records its length. A real interface must define how that value is supplied. This guide does not infer a form's behavior from how an empty pointer is represented in the worksheet.
Do not substitute a default location without documenting it. A task that intentionally selects the root may be asking for an overview of the whole supplied value, while a task selecting / may ask for a particular field. The expected output scope can therefore change substantially even though the pointer strings are short. An assistant should leave a missing instruction unresolved rather than silently guessing that root was intended.
The complete root in this example is still only the authored document. Selecting it does not establish access to an external full file or every related record. If the supplied object is itself an excerpt, root refers to that excerpt's root under the declared task. The reviewer needs the source boundary to decide whether a whole-document claim is justified. Precision about an internal path cannot compensate for uncertainty about which document was supplied.
Case E: preserve exact names instead of normalizing a target
Case E authors four top-level keys: Code, code, a key containing U+00E9, and a key containing U+0065 followed by U+0301. Their values are upper, lower, composed and decomposed. The pointers with those exact respective names select those four different supplied values. The uppercase and lowercase names are distinct. The two visually similar accented spellings are also distinct in the supplied object, with no normalization applied by the declared location rule.
A reader may have good reasons to discuss a normalization policy elsewhere, but applying one during this selection would change the task. If a normalization step collapses two supplied names, an application needs a rule for the resulting conflict. This guide does not choose such a rule. It keeps the exact supplied names and points to the separate Unicode-comparison guide for that broader representation topic. A path review should not silently introduce a record-cleaning policy.
For an AI request, include an unambiguous description when appearance alone could hide a difference. Code-point notation can help explain why two displayed keys are not the same string. Avoid claiming that either spelling represents a real person's name or an incorrect input. In this fictional example, they were deliberately authored as distinct keys so that their location behavior could be examined without inferring business identity from typography.
Also avoid applying lowercase conversion to the whole pointer as a convenience. In this example it would change /Code into /code and select a different value. A result can still look plausible after that mistake. That is why checking only whether a value was returned is insufficient. The reviewer should compare the exact requested location, the supplied key spelling and the expected selected value before relying on a downstream summary.
Case F: a located null differs from a missing target
Case F supplies an object with status set to null and count set to zero. The pointer /status resolves to a present null value. The pointer /count resolves to the numeric value zero. The pointer /missing does not find a target in the authored object. These three outcomes must remain separate in the report. Replacing a missing selection with null would erase information about whether the field existed at the requested location.
A structured result can record selection success separately from the selected value. For this teaching case, one result says found true with value null, another says found true with value zero, and a third says found false with no selected value. That is an original reporting design for the examples, not a universal API response format. An actual application needs to define its own error and result contract before a reviewer interprets a returned null.
Do not let a model invent the missing field from neighboring context. It can explain that the supplied document lacks the requested target, but a guessed status would be new content. Likewise, zero should not be described as missing merely because a language's convenience check treats it as false-like. The existing missing-state guide covers that broader distinction. Here, the path result and the value type remain visible so that later validation can address the right question.
A successful location does not establish business completeness. A field can be present with a null value while its intended meaning remains unresolved. Conversely, a missing field may be expected under a particular schema. The examples do not supply a production schema or a policy decision. They establish only the stated presence and values in the authored object. Keep that limited observation separate from a claim that a real record passed its required checks.
Build an extraction request that a reviewer can reproduce
For a concrete review note, preserve the selected value's type as well as its spelling. A string containing the characters 0 and a numeric zero can occupy neighboring fields while serving different purposes. A pointer can locate either field precisely, but it does not convert one type into the other or explain which the task intended. Pair the selection result with the declared expected type, then report a mismatch as a separate issue. That keeps location accuracy from being mistaken for a complete validation result and gives the next reviewer a specific question to resolve without changing the original document.
A useful request identifies the document snapshot, location syntax, exact pointer, expected value kind and desired handling of an unresolved target. Include enough surrounding structure to show what each token traverses. If only a fragment is supplied, label it as a fragment. That makes the scope reviewable without asking the assistant to infer an unseen document. The result should retain the selected pointer so a human can trace it back to the supplied structure.
For a fictional request, you might ask: in EX-DOC-C, interpret these locations as JSON Pointer strings; report selection success separately from value; preserve exact object names and array order; do not invent missing values or update the document. This is an original task instruction, not a tested prompt or an observed model response. The deterministic selection examples are checked independently; the quality of any future model response would require its own evaluation.
When a location returns a surprising value, inspect the path before changing the data. Did a slash belong inside a key? Did an escape sequence receive an extra decoding pass? Did a numeric-looking token address an array or an object? Did a case change select a neighboring field? These questions are grounded in the supplied cases. They are diagnostic prompts for investigation, not evidence that a real provider or application made one of these mistakes.
When several fields are needed, keep their locations distinct in the request and output. Do not summarize a selected item as the whole file or one array entry as all records. Record which values were actually supplied and which remain unresolved. That makes later arithmetic and prose interpretation easier to assess: a calculation can be correct for the wrong selected field, and a fluent summary can hide that selection error unless its source locations remain visible.
Frequently asked questions
Does a slash always mean another nested level?
In these declared string-form JSON Pointer examples, separators and escaped slashes inside tokens have different roles. Case A deliberately contrasts /route/label with /route~1label and obtains different supplied values. Keep the exact expression and document structure available instead of paraphrasing both selections as reading the label.
Should I decode escape-looking text repeatedly?
No. Case B follows the declared token decoding order once. Its /~01 token selects a literal key named ~1 rather than the separate slash key. Repeated decoding would be an additional transformation. The examples do not evaluate a real interface or establish general parser conformance.
Is the first array item a permanent record reference?
No. Case C uses position zero in a particular supplied snapshot. Reversing that authored array changes which item the same pointer selects. If the task needs an item by identifier, specify that separate requirement and its handling of absent or repeated identifiers rather than treating position as identity.
Are an empty pointer and a single slash interchangeable?
No. Case D selects the supplied root with the empty string and its empty-key member with /. A missing instruction is another state again. Represent the empty string explicitly in review notes so it cannot be mistaken for an unfilled form or an absent location value.
Can I lowercase or normalize a pointer first?
That would introduce a separate transformation and can change the selected value, as Case E shows. The examples preserve exact names. A normalization policy needs its own purpose and conflict handling; this guide does not apply one or decide business identity from similar-looking keys.
What does a successful selection prove?
Only that the stated supplied example resolves to the reported value under the declared interpretation. Case F keeps a located null separate from a missing target. No actual model, provider, schema acceptance, record correctness, security control, destination update or professional review is established by these teaching checks.
Original fictional practice data
Original fictional teaching cases, not actual client records, reservations, model outputs, professional review or operating approval. No executable utility is supplied.
| fictional case | authored inputs | bounded result |
|---|---|---|
| A | {"document":{"route/label":"outer","route":{"label":"inner"}},"expectations":{"/route~1label":"outer","/route/label":"inner"}} | One slash-containing key versus nestedtwolevels selectouter/inner NOTintendedbusinessfield |
| B | {"document":{"tag~name":"T","~1":"literal-sequence","/":"slash-key"},"expectations":{"/tag~0name":"T","/~01":"literal-sequence","/~1":"slash-key"}} | Declareddecodeorder selectsT/literal-sequence/slash-key NOTrepeateddecoding/keyrename |
| C | {"document":{"items":[{"id":"EX-A"},{"id":"EX-B"}],"codes":{"01":"object-code"}},"expectations":{"/items/0/id":"EX-A","/items/1/id":"EX-B","/codes/01":"object-code"},"invalidArrayPointer":"/items/01/id","reversedFirst":"EX-B"} | Arrayindices0/1selectEX-A/B;01invalidarrayindex butvalidobjectkey;reversedfirstEX-B NOTstableidentity |
| D | {"document":{"":7,"note":"EX-NOTE"},"expectations":{"":{"":7,"note":"EX-NOTE"},"/":7}} | Emptystringselectsroot;singleSlashselects7atemptykey NOTsame/missinginstruction |
| E | {"document":{"Code":"upper","code":"lower","é":"composed","é":"decomposed"},"expectations":{"/Code":"upper","/code":"lower","/é":"composed","/é":"decomposed"}} | Exactcase/codepointsselectfourdifferentvalues NOTnormalization/realidentity |
| F | {"document":{"status":null,"count":0},"expectations":{"/status":null,"/count":0},"missingPointer":"/missing"} | Foundnull/foundzero versusmissingtarget NOTbusinesscompleteness/defaultsubstitution |
Primary sources and editorial scope
AI-assisted website editorial. Sources read October 28, 2026 America/New_York. Original fictional supplied-data interpretation only; no actual client file, provider, API, model result, security assessment or general parser conformance finding. Original examples checked independently. No record change, actual client dataset, observed model output, professional review, security certification or operating approval is asserted.