JSON Pointer Prefix Relation
Compare decoded pointer token prefixes, never raw string prefixes; root prefixes every valid pointer.
Description
Compare decoded pointer token prefixes, never raw string prefixes; root prefixes every valid pointer.
JSON Pointer ancestry depends on complete decoded tokens. A property called "ab" is not beneath a property called "a" merely because their names share letters.
When to use this tool
Compare decoded pointer token prefixes, never raw string prefixes; root prefixes every valid pointer.
- Prepare the supplied prefix, pointer fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter prefix, pointer. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.isPrefix, result.equal. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Parse prefix and pointer, compare corresponding decoded tokens, and return isPrefix plus equal. The empty root pointer prefixes every valid pointer; equality also counts as a prefix.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| prefix | prefix. | Text; at most 8,192 UTF-16 code units, subject to the grammar above |
| pointer | pointer. | Text; at most 8,192 UTF-16 code units, subject to the grammar above |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.isPrefix | Flag for is prefix under the exact condition described above. |
| result.equal | Flag for equal under the exact condition described above. |
{
"input": {
"prefix": "/a",
"pointer": "/ab"
},
"output": {
"result": {
"isPrefix": false,
"equal": false
}
}
} Limitations and assumptions
- This checks syntactic ancestry only. It does not load a JSON document or establish that either pointer resolves to an existing value.
- Decoded JSON is bounded to 20,000 nodes and 32 nesting levels; record arrays have at most 128 records. Parsed number values use JavaScript floating point rather than arbitrary-precision decimal arithmetic.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- Ordinary string lists have at most 128 entries of at most 128 code units each; numeric lists and matrices have separate bounded size checks. Nonfinite results and excessively large serialized outputs are rejected.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
For document-wide requirements, combine these structural inventories with an explicit JSON Schema. Preserve the distinction between missing properties and null values, and between numbers and numeric-looking strings when building joins or indexes.
References
Similar or alternative tools
- Object Key Prefix Partitioner
Partition own JSON object members by exact literal key prefix; does not strip prefixes or interpret patterns.
- pointer
Resolve an RFC 6901 JSON Pointer against a document and report the located value.