Skip to content

Main content

JSON Object Duplicate Key Span Pair Tool

Compute json object duplicate key span pair from explicit bounded inputs.

Loading tool…

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

  1. Enter leftKey, leftOffset, rightKey, rightOffset. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
leftKeyLeft KeyRequired. Text; maximum UTF-16 length 8192.
leftOffsetLeft OffsetRequired. Safe integer; minimum 0.
rightKeyRight KeyRequired. Text; maximum UTF-16 length 8192.
rightOffsetRight OffsetRequired. Safe integer; minimum 0.
Output fieldInterpretationReturned shape
duplicateDuplicateRequired. Boolean.
offsetsOffsetsRequired. Array of safe integer; maximum items 256.
json
{
  "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

  1. Calculation and input contract: json/json-object-duplicate-key-span-pair — tool.io

Similar or alternative tools