Processing JSON Files

Private AI supports scanning JSON files for PII and creating de-identified or redacted copies. Private AI’s supported entity types function across each file type, with localized variants of different PII (Personally Identifiable Information) entities, PHI (Protected Health Information) entities, and PCI (Payment Card Industry) entities being detected. Our Supported Languages and Supported Entity Types page provides a more detailed look.

How JSONs Are Processed

Similar to XML files, JSON files are processed using the method described in the Structured Data Guide. The output file retains its original format with redaction markers of the format "[LABEL_X]" in place of the detected PII. The file passed in should adhere to the JSON standard as defined.



Please consider writing a handler for your specific application using the Structured Data Guide to get around any of the constraints listed below.

  • The file processing routes are synchronous; large files over 5MB in size may take a long time to process.
  • Only values are redacted. Key names are assumed to never contain PII and are not redacted.
  • Entity detection numbering is consistent within individual values only, not across the entire file.
  • The JSON must be entirely human-readable content. Encoded content such as Base64 is not natively supported and may lead to inaccurate PII detection. Please process this content separately.
  • Due to the way the data is formatted , deeply hierarchical (>10 levels) JSON structures take proportionally longer to process.

Support Matrix

CPU Container GPU Container Demo API Prod API PrivateGPT UI
Supported? Yes Yes No Yes No

Sample Request


Please sign up for a free API key to run this code.

import requests
import base64

file_url = "$web/sample.json"
file_content = requests.get(file_url).content
file_content_base64 = base64.b64encode(file_content).decode()

url = ""

headers = {"Content-Type": "application/json", "x-api-key": "<INSERT API KEY>"}

payload = {
    "data": file_content_base64,
    "content_type": "application/json",
  "entity_detection": {
    "accuracy": "high",
    "return_entity": True

response =, json=payload, headers=headers)

Sample Response

"processed_file": "Base64 Encoded File Content of the Redacted File",
"languages_detected":{"lang_1":0.67, "lang_2": 0.74}
© Copyright 2024 Private AI.