Permit the null key, which is written as "null"

This commit is contained in:
Jesse Wilson 2011-09-09 08:10:21 +00:00
parent d22e11b184
commit 1bb48694f4

View File

@ -96,7 +96,11 @@ public final class GsonCompatibleMapTypeAdapter<V> extends TypeAdapter<Map<Strin
writer.beginObject();
for (Map.Entry<String, V> entry : map.entrySet()) {
writer.name(entry.getKey());
String key = entry.getKey();
if (key == null) {
key = "null";
}
writer.name(key);
valueTypeAdapter.write(writer, entry.getValue());
}
writer.endObject();