{"record":{"id":"f5a214cd5b227b10","repo":"CoplayDev/unity-mcp","slug":"failed-to-parse-properties-json-string-raw-valu-f5a214","errorCode":null,"errorMessage":"Failed to parse 'properties' JSON string. Raw value: {token}","messagePattern":"Failed to parse 'properties' JSON string\\. Raw value: (.+?)","errorType":"exception","errorClass":"JsonException","httpStatus":null,"severity":"error","filePath":"MCPForUnity/Editor/Tools/Vfx/ManageVFX.cs","lineNumber":190,"sourceCode":"            if (token == null || token.Type == JTokenType.Null)\n            {\n                return null;\n            }\n\n            if (token is JObject obj)\n            {\n                return obj;\n            }\n\n            if (token.Type == JTokenType.String)\n            {\n                try\n                {\n                    return JToken.Parse(token.ToString()) as JObject;\n                }\n                catch (JsonException ex)\n                {\n                    throw new JsonException(  \n                        $\"Failed to parse 'properties' JSON string. Raw value: {token}\",  \n                        ex); \n                }\n            }\n\n            return null;\n        }\n\n        private static string NormalizeKey(string key, bool allowAliases)\n        {\n            if (string.IsNullOrEmpty(key))\n            {\n                return key;\n            }\n            if (string.Equals(key, \"action\", StringComparison.OrdinalIgnoreCase))\n            {\n                return \"action\";\n            }","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/MCPForUnity/Editor/Tools/Vfx/ManageVFX.cs#L172-L208","documentation":"Thrown by the VFX properties parser in ManageVFX when the 'properties' parameter is a JSON string that fails to parse. The method accepts properties as a JSON object or as a string containing valid JSON; if the string is malformed, JToken.Parse raises a JsonException that is wrapped with this message including the raw value.","triggerScenarios":"Calling a VFX tool (set_property, configure, etc.) with properties passed as a JSON string that contains a syntax error: missing quotes, trailing commas, unescaped characters, or truncated JSON.","commonSituations":"AI generates JSON by string concatenation instead of using a serializer; copy-paste introduces invisible characters or truncation; properties string is actually a key=value format rather than JSON; single quotes used instead of double quotes.","solutions":["Pass properties as a native JSON object instead of a string so the framework handles serialization.","Validate the JSON string locally with a parser before sending (e.g. json.loads in Python).","Use double quotes for all JSON keys and string values.","If building the string programmatically, use json.dumps() rather than string formatting."],"exampleFix":"// before (malformed JSON string)\nparams = {\"properties\": \"{emissionRate: 100,}\"}\n// after (native object)\nparams = {\"properties\": {\"emissionRate\": 100}}","handlingStrategy":"validation","validationCode":"import json\n\ndef validate_properties_json(props):\n    if isinstance(props, dict):\n        return True\n    if isinstance(props, str):\n        try:\n            json.loads(props)\n            return True\n        except json.JSONDecodeError:\n            return False\n    return False","typeGuard":null,"tryCatchPattern":"try\n{\n    var propsObj = ParsePropertiesToken(token);\n}\ncatch (JsonException ex) when (ex.Message.Contains(\"Failed to parse 'properties'\"))\n{\n    return new ErrorResponse($\"Invalid properties JSON: {ex.Message}\");\n}","preventionTips":["Pass properties as a native JSON object rather than a string to let the framework serialize.","Always validate JSON strings with a parser before sending.","Use json.dumps() for serialization, never string formatting.","Ensure double quotes throughout JSON."],"tags":["vfx","json","parse-error","validation","manage-vfx"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}