Description
Compare leftKey and rightKey literally and return their offsets only when equal.
A JSON member can be absent, present with null, or present with an empty string. Testing own-property presence preserves those distinctions instead of relying on truthiness.
Compare leftKey and rightKey literally and return their offsets only when equal.
When to use this tool
Use JSON Object Duplicate Key Span Pair when you need an explicit object-member presence or key comparison.
How to use the tool and how it works
- Enter leftKey, leftOffset, rightKey, rightOffset. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read duplicate, offsets. Inspect duplicate before interpreting the associated values.
Require ordered nonnegative offsets with leftOffset < rightOffset. Compare leftKey and rightKey literally and return their offsets only when equal.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| leftKey | Left Key | Required. Text; maximum UTF-16 length 8192. |
| leftOffset | Left Offset | Required. Safe integer; minimum 0. |
| rightKey | Right Key | Required. Text; maximum UTF-16 length 8192. |
| rightOffset | Right Offset | Required. Safe integer; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| duplicate | Duplicate | Required. Boolean. |
| offsets | Offsets | Required. Array of safe integer; maximum items 256. |
{
"input": {
"leftKey": "a",
"leftOffset": 1,
"rightKey": "a",
"rightOffset": 8
},
"output": {
"duplicate": true,
"offsets": [
1,
8
]
}
} Limitations and assumptions
- This inspects a supplied pair rather than scanning JSON; escape-equivalent keys must already be decoded if they should compare equal.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use a complete schema and document comparison when conditional requirements or nested structures matter.
References
Similar or alternative tools
- JSON: JSON Property Name Nfc Collision Pair
Normalize first and second to NFC, compare their original strings and normalized strings, and mark normalizationCollision only when distinct originals normalize identically.
- JSON Schema Required Single Key Check
Parse objectJson as a plain JSON object and test Object.hasOwn for the literal key.