anchor.diff:      final result = <Object, Object>{discriminator: type};
       for (int i = 0; i != (list.length - 1) ~/ 2; ++i) {
         final key =
  -          needToEncodeKeys ? _toStringKey(list[i * 2 + 1]) : list[i * 2 + 1];
  +          needToEncodeKeys ? _encodeKey(list[i * 2 + 1]) : list[i * 2 + 1];
         final value = list[i * 2 + 2];
         result[key] = value;
       }
       return result;
     }
   
  -  String _toStringKey(Object key) {
  +  /// JSON-encodes an `Object` key so it can be stored as a `String`. Needed
  +  /// because JSON maps are only allowed strings as keys.
  +  String _encodeKey(Object key) {
       return JSON.encode(key);
     }
   
  -  List _toList(Map map, bool alreadyStringKeys) {
  +  /// Converts [StandardJsonPlugin] serialization output, a `Map`, to a `List`,
  +  /// when the serialized type is known statically.
  +  List _toList(Map map, bool hasEncodedKeys) {
       final result = new List(map.length * 2);
       var i = 0;
       map.forEach((key, value) {
         // Drop null values, they are represented by missing keys.
         if (value == null) return;
   
  -      result[i] = alreadyStringKeys ? key : _fromStringKey(key as String);
  +      result[i] = hasEncodedKeys ? _decodeKey(key as String) : key;
         result[i + 1] = value;
         i += 2;
       });
       return result;
     }
   
  -  List _toListExtractType(Map map) {
  +  /// Converts [StandardJsonPlugin] serialization output, a `Map`, to a `List`,
  +  /// when the serialized type is not known statically. The type is retrieved
  +  /// from the [discriminator] field.
  +  List _toListUsingDiscriminator(Map map) {
       var type = map[discriminator];
   
       if (type == null) {
  
positive.code:   Object beforeDeserialize(Object object, FullType specifiedType) {
      if (object is Map && specifiedType.root != JsonObject) {
        if (specifiedType.isUnspecified) {
          return _toListExtractType(object);
        } else {
          return _toList(object, _alreadyHasStringKeys(specifiedType));
        }
      } else {
        return object;
  
negative.code:       // Drop null values, they are represented by missing keys.
        if (value == null) return;
  
        result[i] = needToDecodeKeys ? _decodeKey(key as String) : key;
        result[i + 1] = value;
        i += 2;
      });
      return result;
    }
  
    /// JSON-decodes a `String` encoded using [_encodeKey].
    Object _decodeKey(String key) {
      return JSON.decode(key);
    }
  }
  