JSON One Of Key Presence Check
Check exactly-one own member presence across an explicit unique group; null values still count as present.
Description
Check exactly-one own member presence across an explicit unique group; null values still count as present.
An exactly-one presence rule counts keys rather than their values. A null-valued member is still present.
When to use this tool
Check exactly-one own member presence across an explicit unique group; null values still count as present.
- Prepare the supplied objectJson, candidateKeys 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 objectJson, candidateKeys. 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.presentKeys, result.exactlyOnePresent. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Require a nonempty list of unique nonblank candidateKeys, parse objectJson as an object and return the candidates present as own keys. exactlyOnePresent requires a count of one.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| objectJson | JSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file. | Text |
| candidateKeys | candidate keys. | At most 128 strings, each at most 128 UTF-16 code units |
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.
[
{
"field": "objectJson",
"decoded": {
"a": null
}
}
] | Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.presentKeys | The present keys list in the ordering and representation described above. |
| result.exactlyOnePresent | Flag for exactly one present under the exact condition described above. |
{
"input": {
"objectJson": "{\"a\":null}",
"candidateKeys": [
"a",
"b"
]
},
"output": {
"result": {
"presentKeys": [
"a"
],
"exactlyOnePresent": true
}
}
} Limitations and assumptions
- No truthiness, property-value validation or broader JSON Schema oneOf semantics is applied.
- 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
Similar or alternative tools
- JSON All Or None Key Presence Check
Check all-or-none own member presence for an explicit key group; absent versus null is preserved.
- JSON Dependent Key Presence Check
Audit own-member dependencies when a trigger exists, including a null trigger value; do not infer semantic value requirements.