JSON Array Length Policy Check

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

Description

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

A recursive array-length policy can report which arrays fall outside an inclusive permitted interval.

When to use this tool

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

  • Prepare the supplied documentJson, minimumLength, maximumLength 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 documentJson, minimumLength, maximumLength. 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.violations. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Require integer minimumLength/maximumLength from 0 to 10,000 in order. Visit every parsed JSON array and report its path and length when below minimum or above maximum.1

Input fieldMeaning and representationAccepted input
documentJsonJSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file.Text
minimumLengthminimum length.Integer from 0 to 10000 inclusive
maximumLengthmaximum length.Integer from minimumLength to 10000 inclusive

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": "documentJson",
    "decoded": {
      "a": [],
      "b": [
        1
      ]
    }
  }
]
Output fieldInterpretation
resultObject containing the named outputs below.
result.violationsSource positions or records that fail the specific screen above; an empty list means no such violation.
json
{
  "input": {
    "documentJson": "{\"a\":[],\"b\":[1]}",
    "minimumLength": 1,
    "maximumLength": 2
  },
  "output": {
    "result": {
      "violations": [
        {
          "path": "/a",
          "length": 0
        }
      ]
    }
  }
}

Limitations and assumptions

  • Object property counts and string lengths are not tested. No arrays are resized and no full JSON Schema validation is performed.
  • 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.
  • String lists have at most 128 entries of at most 128 code units; matrices have at most 128 rows and columns. Larger numeric lists and parsed JSON have separate bounded budgets. 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

Use a full schema validator when several shape, type and value constraints must work together. These tools apply the one declared presence, name, length or leaf policy and return explicit evidence of its scope.

References

  1. Tool behavior and example: JSON Array Length Policy Check — tool.io

Similar or alternative tools

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