Record Array Unique Key Indexer

Build a unique typed-scalar record index as entries; numeric and string keys remain distinct, missing and duplicate keys fail.

Description

Build a unique typed-scalar record index as entries; numeric and string keys remain distinct, missing and duplicate keys fail.

A record index maps unique scalar keys back to their original positions. Keeping keys as values avoids coercing numeric and textual keys into identical object-property names.

When to use this tool

Build a unique typed-scalar record index as entries; numeric and string keys remain distinct, missing and duplicate keys fail.

  • Prepare the supplied recordsJson, keyField 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

  1. Enter recordsJson, keyField. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.index. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Require every record to contain an own scalar keyField and reject duplicate typed keys. Return an index array of key and original recordIndex pairs.1

Input fieldMeaning and representationAccepted input
recordsJsonJSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file.Text
keyFieldkey field.Text; at most 8,192 UTF-16 code units, subject to the grammar above

For the JSON text fields, the following decoded structures show the example records before they are serialized into input strings. Keep field names, list nesting and value types as shown.

json
[
  {
    "field": "recordsJson",
    "decoded": [
      {
        "id": 1
      },
      {
        "id": "1"
      }
    ]
  }
]
Output fieldInterpretation
resultObject containing the named outputs below.
result.indexThe index list in the ordering and representation described above.
json
{
  "input": {
    "recordsJson": "[{\"id\":1},{\"id\":\"1\"}]",
    "keyField": "id"
  },
  "output": {
    "result": {
      "index": [
        {
          "key": 1,
          "recordIndex": 0
        },
        {
          "key": "1",
          "recordIndex": 1
        }
      ]
    }
  }
}

Limitations and assumptions

  • Number 1 and string "1" remain different keys. This is a separate lookup index, not an object keyed by coerced strings or a reordered record collection.
  • 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

  1. Tool behavior and example: Record Array Unique Key Indexer — tool.io

Similar or alternative tools

  • JSON Array Homogeneity Audit

    Audit immediate element-type homogeneity for every JSON array; an empty array is vacuously homogeneous, not evidence of a particular type.

  • json array length policy check

    Audit all JSON array lengths against inclusive bounds; no inferred schema or scalar-array coercion.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies