Skip to content

Commit 415d06e

Browse files
committed
Make json serialization treat maps as maps, always.
Even if they are iterable, like clojure maps.
1 parent 0a154ba commit 415d06e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

google-http-client/src/main/java/com/google/api/client/json/JsonGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ private void serialize(boolean isJsonString, Object value) throws IOException {
139139
writeBoolean((Boolean) value);
140140
} else if (value instanceof DateTime) {
141141
writeString(((DateTime) value).toStringRfc3339());
142-
} else if (value instanceof Iterable<?> || valueClass.isArray()) {
142+
} else if ((value instanceof Iterable<?> || valueClass.isArray()) &&
143+
!(value instanceof Map<?, ?>) && !(value instanceof GenericData)) {
143144
writeStartArray();
144145
for (Object o : Types.iterableOf(value)) {
145146
serialize(isJsonString, o);

0 commit comments

Comments
 (0)