Audit and clean JSON rows
trust_clean_dataAudit and optionally clean up to 500 JSON rows, returning cleaned_rows, original zero-based issues and counts. Processing order is trim, primary-key deduplication, then required/range checks: keys " a " and "a" collide after trimming. Duplicate removal keeps the first row and skips later-row field checks; missing keys are retained and flagged. REVIEW persists even after repair, so inspect issues before use; [] returns ALLOW. Numeric strings are not converted or range-checked; use trust_validate_data for type enforcement. Only top-level strings are trimmed; inputs are not mutated. Free, unauthenticated, stateless pilot: rules apply only to this call. Usage metadata is recorded; request bodies are not stored.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | JSON object rows; at most 500. An empty array is valid. | |
| primary_key | No | Top-level key used for duplicate detection; defaults to id. Keys compare by JSON serialization, so 1 differs from "1". | id |
| trim_strings | No | Trim leading/trailing whitespace from top-level strings; nested values are unchanged. | |
| numeric_ranges | No | Inclusive bounds for top-level fields that already contain numbers. Use validation for numeric type enforcement. | |
| required_fields | No | Top-level field names that must be present and non-null/non-empty. Checked after optional trimming. | |
| remove_duplicates | No | Drop later rows with the same primary key; missing keys are flagged and retained. Duplicate rows are skipped before required/range checks. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | The operation completed; does not imply the verdict is ALLOW. | |
| issues | Yes | Audit findings with original zero-based row positions. | |
| service | Yes | Service that evaluated the request. | |
| verdict | Yes | ALLOW: no findings. REVIEW: inspect issues, including removed duplicates. BLOCK: invalid row input. | |
| version | Yes | Deployed implementation version. | |
| warning | Yes | Deterministic cleanup limitations. | |
| input_count | Yes | Original row count. | |
| cleaned_rows | Yes | New row objects after the selected transformations. | |
| output_count | Yes | Returned row count. |