Update Serializer condition to the check for null.
`k` is a String variable, so `(k instanceof String)` can only be false if `k` is `null`. Updated the condition to reflect this.
@@ -107,8 +107,8 @@ class Serializer {
Iterator<String> keys = m.keys();
while (keys.hasNext()) {
String k = keys.next();
- if (!(k instanceof String)) {
- throw new IllegalArgumentException("Object keys must be strings.");
+ if (k == null) {
+ throw new IllegalArgumentException("Object keys cannot be null.");
}
String key = (String) k;
Object value = encode(m.opt(k));
