Index: TFP-WebServer/WebServer/src/WebAPI/APIs/ServerState/GamePrefs.cs
===================================================================
--- TFP-WebServer/WebServer/src/WebAPI/APIs/ServerState/GamePrefs.cs	(revision 439)
+++ TFP-WebServer/WebServer/src/WebAPI/APIs/ServerState/GamePrefs.cs	(revision 457)
@@ -5,21 +5,11 @@
 namespace Webserver.WebAPI.APIs.ServerState {
 	[UsedImplicitly]
-	public class GamePrefs : AbsRestApi {
-		private static readonly byte[] keyType = JsonWriter.GetEncodedPropertyNameWithBeginObject ("type");
-		private static readonly byte[] keyValue = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("value");
-		private static readonly byte[] keyDefault = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("default");
+	public class GamePrefs : KeyValueListAbs {
+		public GamePrefs () : base ("GamePrefs") {
+		}
 
-		private int largestBuffer;
-
-		protected override void HandleRestGet (RequestContext _context) {
-			PrepareEnvelopedResult (out JsonWriter writer);
-			
-			writer.EnsureCapacity (largestBuffer);
-			writer.WriteBeginObject ();
-
-			bool first = true;
+		protected override void iterateList (ref JsonWriter _writer, ref bool _first) {
 			foreach (EnumGamePrefs stat in EnumUtils.Values<EnumGamePrefs> ()) {
 				string name = stat.ToStringCached ();
-				global::GamePrefs.EnumType? type = global::GamePrefs.GetPrefType (stat);
 
 				if (name.Contains ("Password", StringComparison.Ordinal)) {
@@ -27,86 +17,28 @@
 				}
 
-				if (!first) {
-					writer.WriteValueSeparator ();
-				}
+				global::GamePrefs.EnumType? type = global::GamePrefs.GetPrefType (stat);
+				object defaultValue = global::GamePrefs.GetDefault (stat);
 
-				first = false;
-				
-				writer.WritePropertyName (name);
-				
-				writer.WriteRaw (keyType);
-				writer.WriteString (type.HasValue ? type.Value.ToStringCached () : "noType");
-				
-				writer.WriteRaw (keyValue);
 				switch (type) {
 					case global::GamePrefs.EnumType.Int:
-						writer.WriteInt32 (global::GamePrefs.GetInt (stat));
+						int? defaultInt = defaultValue as int?;
+						addItem (ref _writer, ref _first, name, global::GamePrefs.GetInt (stat), defaultInt);
 						break;
 					case global::GamePrefs.EnumType.Float:
-						writer.WriteSingle (global::GamePrefs.GetFloat (stat));
+						float? defaultFloat = defaultValue as float?;
+						addItem (ref _writer, ref _first, name, global::GamePrefs.GetFloat (stat), defaultFloat);
 						break;
 					case global::GamePrefs.EnumType.String:
-						writer.WriteString (global::GamePrefs.GetString (stat));
+						string defaultString = defaultValue as string;
+						addItem (ref _writer, ref _first, name, global::GamePrefs.GetString (stat), defaultString);
 						break;
 					case global::GamePrefs.EnumType.Bool:
-						writer.WriteBoolean (global::GamePrefs.GetBool (stat));
-						break;
-					default:
-						writer.WriteNull ();
+						bool? defaultBool = defaultValue as bool?;
+						addItem (ref _writer, ref _first, name, global::GamePrefs.GetBool (stat), defaultBool);
 						break;
 				}
-				
-				writer.WriteRaw (keyDefault);
-				object defaultValue = global::GamePrefs.GetDefault (stat);
-				switch (type) {
-					case global::GamePrefs.EnumType.Int:
-						if (defaultValue is int defaultInt) {
-							writer.WriteInt32 (defaultInt);
-						} else {
-							writer.WriteNull ();
-						}
+			}
+		}
 
-						break;
-					case global::GamePrefs.EnumType.Float:
-						if (defaultValue is float defaultFloat) {
-							writer.WriteSingle (defaultFloat);
-						} else {
-							writer.WriteNull ();
-						}
-
-						break;
-					case global::GamePrefs.EnumType.String:
-						if (defaultValue is string defaultString) {
-							writer.WriteString (defaultString);
-						} else {
-							writer.WriteNull ();
-						}
-
-						break;
-					case global::GamePrefs.EnumType.Bool:
-						if (defaultValue is bool defaultBool) {
-							writer.WriteBoolean (defaultBool);
-						} else {
-							writer.WriteNull ();
-						}
-
-						break;
-					default:
-						writer.WriteNull ();
-						break;
-				}
-
-				writer.WriteEndObject ();
-			}
-			
-			writer.WriteEndObject ();
-
-			int bufferContentSize = writer.CurrentOffset + 128;
-			if (bufferContentSize > largestBuffer) {
-				largestBuffer = bufferContentSize;
-			}
-			
-			SendEnvelopedResult (_context, ref writer);
-		}
 	}
 }
