-
Notifications
You must be signed in to change notification settings - Fork 0
JSON Mode
Nick edited this page Nov 27, 2025
·
1 revision
Masker API can process entire JSON structures, recursively scanning and redacting PII in all string values while preserving the JSON structure.
JSON mode processes JSON objects and arrays recursively:
- Only string values are scanned for PII
- JSON structure is preserved
- Non-string values (numbers, booleans, null) remain unchanged
- Arrays are processed recursively
Input:
{
"user": {
"name": "John Doe",
"email": "john@example.com",
"age": 30,
"phone": "555-123-4567",
"tags": ["developer", "john@example.com"]
}
}Request:
curl -X POST "https://masker.kikuai.dev/v1/redact" \
-H "Content-Type: application/json" \
-d '{
"json": {
"user": {
"name": "John Doe",
"email": "john@example.com",
"age": 30,
"phone": "555-123-4567",
"tags": ["developer", "john@example.com"]
}
},
"mode": "placeholder"
}'Response:
{
"redacted_text": null,
"redacted_json": {
"user": {
"name": "<PERSON>",
"email": "<EMAIL>",
"age": 30,
"phone": "<PHONE>",
"tags": ["developer", "<EMAIL>"]
}
},
"items": [
{
"entity_type": "PERSON",
"path": "user.name",
"start": 0,
"end": 8,
"score": 0.85
},
{
"entity_type": "EMAIL",
"path": "user.email",
"start": 0,
"end": 16,
"score": 1.0
},
{
"entity_type": "PHONE",
"path": "user.phone",
"start": 0,
"end": 12,
"score": 1.0
},
{
"entity_type": "EMAIL",
"path": "user.tags[1]",
"start": 0,
"end": 16,
"score": 1.0
}
],
"processing_time_ms": 23.46
}- JSON structure is completely preserved
- Only string values are modified
- Numbers, booleans, null values remain unchanged
Each detected entity includes a path field showing its location:
-
"user.name"- Object property -
"user.tags[1]"- Array element -
"data.users[0].email"- Nested structure
- Nested objects are processed recursively
- Arrays are processed element by element
- Deep nesting is supported
user_data = {
"id": 12345,
"name": "John Doe",
"email": "john@example.com",
"profile": {
"phone": "555-123-4567",
"address": "123 Main St"
}
}
# Anonymize before AI analysis
response = requests.post(
"https://masker.kikuai.dev/v1/redact",
json={"json": user_data, "mode": "placeholder"}
)form_data = {
"name": "Jane Smith",
"email": "jane@example.com",
"message": "Need help with my account",
"metadata": {
"source": "web",
"timestamp": "2025-11-27"
}
}
# Clean before LLM processing
cleaned = requests.post(
"https://masker.kikuai.dev/v1/redact",
json={"json": form_data, "mode": "placeholder"}
).json()["redacted_json"]You can filter which entity types to redact:
{
"json": {
"user": {
"name": "John Doe",
"email": "john@example.com",
"phone": "555-123-4567"
}
},
"mode": "placeholder",
"entities": ["EMAIL"]
}Result: Only email addresses are redacted, names and phones remain unchanged.
- Maximum payload size: 64KB
- Maximum nesting depth: No hard limit (but very deep nesting may impact performance)
- Array size: No hard limit (but large arrays may impact performance)
- Use entity filtering when you only need specific PII types
- Process large JSON in chunks if it exceeds 64KB
-
Check
processing_time_msto monitor performance -
Use
pathfield to track where PII was found
Last Updated: 2025-11-27