{
  "id": "dotnet/serialization-json-ignore-attribute",
  "signature": "System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.propertyName | LineNumber: 1 | BytePositionInLine: 20.",
  "signature_zh": "System.Text.Json.JsonException: JSON 值无法转换为 System.String。路径: $.propertyName | 行号: 1 | 字节位置: 20。",
  "regex": "JsonException: The JSON value could not be converted to",
  "domain": "dotnet",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "System.Text.Json deserialization fails because a JSON property has an unexpected type (e.g., number instead of string) or is missing, often due to mismatched model attributes like JsonIgnore.",
  "root_cause_type": "generic",
  "root_cause_zh": "System.Text.Json 反序列化失败，因为 JSON 属性类型不匹配（例如数字而非字符串）或缺失，通常由模型属性不匹配（如 JsonIgnore）引起。",
  "versions": [
    {
      "version": "System.Text.Json 6.0.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "System.Text.Json 7.0.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "System.Text.Json 8.0.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Adding JsonSerializerOptions.IgnoreNullValues doesn't fix type mismatches.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Changing the JSON source to match the C# model is often not feasible in production.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using JsonSerializerOptions.PropertyNameCaseInsensitive only helps with casing, not types.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add a custom JsonConverter to handle type conversion, e.g., convert number to string.",
      "success_rate": 0.85,
      "how": "Add a custom JsonConverter to handle type conversion, e.g., convert number to string.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use JsonSerializerOptions.Converters to register converter globally.",
      "success_rate": 0.9,
      "how": "Use JsonSerializerOptions.Converters to register converter globally.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Change the C# model property type to object or JsonElement and handle casting manually.",
      "success_rate": 0.7,
      "how": "Change the C# model property type to object or JsonElement and handle casting manually.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Add a custom JsonConverter to handle type conversion, e.g., convert number to string.",
    "Use JsonSerializerOptions.Converters to register converter globally.",
    "Change the C# model property type to object or JsonElement and handle casting manually."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/how-to?pivots=dotnet-8-0",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}