{
  "id": "pitfall.ps51-rdap-byte-array",
  "version": 1,
  "category": "integration_pitfall",
  "severity": "medium",
  "lifecycleStatus": "ACTIVE",
  "lifecycle": {
    "status": "ACTIVE",
    "appliesTo": "Windows PowerShell 5.1 / REST APIs",
    "verifiedAt": 1795800000000,
    "reviewDueAt": 1858872000000,
    "replacedBy": "",
    "retireReason": ""
  },
  "contentOrigin": "HUMAN_ORIGINAL",
  "aiModel": "",
  "summaryEn": "Explains why PowerShell 5.1 `Invoke-WebRequest -UseBasicParsing` returns a raw byte array for `+json` MIME types like RDAP.",
  "match": {
    "field": "command",
    "containsAny": [
      "application/rdap+json",
      "application/problem+json"
    ]
  },
  "actions": [
    "EXPLAIN_TO_USER"
  ],
  "indicators": [],
  "knowledge": {
    "environment": "Windows PowerShell 5.1 calling REST endpoints with vendor `+json` media types",
    "symptom": "Piping `$res.Content | ConvertFrom-Json` yields empty fields or fails silently on `application/rdap+json` responses.",
    "rootCause": "PowerShell 5.1 treats non-standard JSON content types as binary `byte[]` instead of UTF-8 strings.",
    "verifiedFix": "Check if `$res.Content` is `byte[]` and decode explicitly via `[System.Text.Encoding]::UTF8.GetString($res.Content)` before calling `ConvertFrom-Json`.",
    "verificationCheck": "Verify decoded string starts with `{` and parses cleanly into expected JSON properties.",
    "commandPattern": "[System.Text.Encoding]::UTF8.GetString($res.Content) | ConvertFrom-Json",
    "commandRisk": "READ_ONLY",
    "license": "CC0-1.0",
    "sourceBasis": "SELF_AUTHORED_FIX"
  },
  "playbookSha256": "9fccd1866e9aaca9848d8aea67d228e2c0391db651ecff41d86bc35f364772f6",
  "snapshotSha256": "116114a19ef52fd932a20216d0c0a4136c3ef2489839d44e6e031683fb594cd2",
  "advisoryOnly": true
}
