diff --git a/JsonClassGeneratorLib/CodeWriters/PythonCodeWriter.cs b/JsonClassGeneratorLib/CodeWriters/PythonCodeWriter.cs index d0239be..35271bb 100644 --- a/JsonClassGeneratorLib/CodeWriters/PythonCodeWriter.cs +++ b/JsonClassGeneratorLib/CodeWriters/PythonCodeWriter.cs @@ -147,11 +147,13 @@ public void WriteClassMembers(StringBuilder sw, JsonType type, String prefix) mappingFunction.AppendLine(mappingString); fields.Append(internalPropertyAttribute + ", "); } - - // Remove trailing comma - fields.Length--; - fields.Length--; - + + // Remove trailing comma and trailing space + if (fields.Length > 0) + { + fields.Length -= 2; + } + // Write Dictionnary Mapping Functions sw.AppendLine(); sw.AppendLine(" @staticmethod");