{
  "id": "unity/script-invalid-json-serialization",
  "signature": "JsonSerializationException: Invalid JSON input for type 'PlayerData'",
  "signature_zh": "JsonSerializationException：类型“PlayerData”的 JSON 输入无效",
  "regex": "JsonSerializationException: Invalid JSON input for type",
  "domain": "unity",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The JSON string passed to JsonUtility.FromJson does not match the expected structure of the target class.",
  "root_cause_type": "generic",
  "root_cause_zh": "传递给 JsonUtility.FromJson 的 JSON 字符串与目标类的预期结构不匹配。",
  "versions": [
    {
      "version": "Unity 2021.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Unity 2022.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Unity 2023.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Wrap the JSON parsing in a try-catch block and ignore the exception.",
      "why_fails": "Ignoring the exception leads to null data and potential runtime errors later.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Use Newtonsoft.Json instead of JsonUtility without changing the input format.",
      "why_fails": "If the JSON is malformed, Newtonsoft.Json will also fail or produce unexpected results.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Validate the JSON string before deserialization using a JSON validator. Ensure fields match the class structure exactly (case-sensitive).",
      "success_rate": 0.9,
      "how": "Validate the JSON string before deserialization using a JSON validator. Ensure fields match the class structure exactly (case-sensitive).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the [Serializable] attribute on the target class and ensure all fields are public or have [SerializeField].",
      "success_rate": 0.85,
      "how": "Use the [Serializable] attribute on the target class and ensure all fields are public or have [SerializeField].",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在反序列化之前使用 JSON 验证器验证 JSON 字符串。确保字段与类结构完全匹配（区分大小写）。",
    "在目标类上使用 [Serializable] 属性，并确保所有字段都是公共的或具有 [SerializeField]。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.unity3d.com/ScriptReference/JsonUtility.FromJson.html",
  "official_doc_section": null,
  "error_code": "JSON-101",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2024-08-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}