Serialize this object to json.
Map<String, dynamic> toJson() => Map.fromEntries(keys.map((key) => MapEntry(key.key, key.serialized)));