Skip to content

Commit 051a5f1

Browse files
stleary#838 - Updated the relevant code in JSONObject to use the overridden toString() method for enum values instead of name().
1 parent 6dba722 commit 051a5f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/json/JSONObject.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2653,7 +2653,7 @@ static final Writer writeValue(Writer writer, Object value,
26532653
} else if (value instanceof Boolean) {
26542654
writer.write(value.toString());
26552655
} else if (value instanceof Enum<?>) {
2656-
writer.write(quote(((Enum<?>)value).name()));
2656+
writer.write(quote(value.toString()));
26572657
} else if (value instanceof JSONObject) {
26582658
((JSONObject) value).write(writer, indentFactor, indent);
26592659
} else if (value instanceof JSONArray) {

0 commit comments

Comments
 (0)