Index: binary-improvements2/MarkersMod/src/Markers.cs
===================================================================
--- binary-improvements2/MarkersMod/src/Markers.cs	(revision 391)
+++ binary-improvements2/MarkersMod/src/Markers.cs	(revision 402)
@@ -1,9 +1,11 @@
 using System.Collections.Generic;
 using System.Net;
-using AllocsFixes.JSON;
+using JetBrains.Annotations;
+using Utf8Json;
 using Webserver;
 using Webserver.WebAPI;
 
 namespace Examples {
+	[UsedImplicitly]
 	public class Markers : AbsRestApi {
 		private const int numRandomMarkers = 5;
@@ -11,6 +13,4 @@
 		private readonly Dictionary<string, (int, int)> markers = new Dictionary<string, (int, int)> ();
 
-		private static readonly JsonArray emptyResult = new JsonArray ();
-		
 		public Markers () {
 			GameRandom random = GameRandomManager.Instance.CreateGameRandom ();
@@ -24,51 +24,66 @@
 		}
 
+		private static readonly byte[] jsonKeyId = JsonWriter.GetEncodedPropertyNameWithBeginObject ("id");
+		private static readonly byte[] jsonKeyLat = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("lat");
+		private static readonly byte[] jsonKeyLng = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("lng");
+
 		protected override void HandleRestGet (RequestContext _context) {
 			string id = _context.RequestPath;
 			
+			PrepareEnvelopedResult (out JsonWriter writer);
+			
 			if (string.IsNullOrEmpty (id)) {
-				JsonArray result = new JsonArray ();
+				writer.WriteBeginArray ();
 
+				bool first = true;
 				foreach ((string markerId, (int, int) coordinates) in markers) {
-					JsonObject marker = new JsonObject ();
-					marker.Add ("id", new JsonString (markerId));
-					marker.Add ("lat", new JsonNumber (coordinates.Item1));
-					marker.Add ("lng", new JsonNumber (coordinates.Item2));
-					result.Add (marker);
+					if (!first) {
+						writer.WriteValueSeparator ();
+					}
+					
+					first = false;
+					
+					writeMarkerJson (ref writer, markerId, coordinates);
 				}
-				
-				SendEnvelopedResult (_context, result);
+
+				writer.WriteEndArray ();
+				SendEnvelopedResult (_context, ref writer);
 				return;
 			}
 
 			if (!markers.TryGetValue (id, out (int, int) location)) {
-				SendEnvelopedResult (_context, emptyResult, HttpStatusCode.NotFound);
+				writer.WriteRaw (JsonEmptyData);
+				SendEnvelopedResult (_context, ref writer, HttpStatusCode.NotFound);
 				return;
 			}
 
 			{
-				JsonArray result = new JsonArray ();
-				JsonObject marker = new JsonObject ();
-				marker.Add ("id", new JsonString (id));
-				marker.Add ("lat", new JsonNumber (location.Item1));
-				marker.Add ("lng", new JsonNumber (location.Item2));
-				result.Add (marker);
-				SendEnvelopedResult (_context, result);
+				writer.WriteBeginArray ();
+				
+				writeMarkerJson (ref writer, id, location);
+				
+				writer.WriteEndArray ();
+				SendEnvelopedResult (_context, ref writer);
 			}
 		}
 
-		protected override void HandleRestPost (RequestContext _context, JsonNode _jsonBody) {
-			if (!(_jsonBody is JsonObject bodyObject)) {
-				SendEnvelopedResult (_context, null, HttpStatusCode.BadRequest, _jsonBody, "BODY_NOT_OBJECT");
+		private void writeMarkerJson (ref JsonWriter _writer, string _markerId, (int, int) _coordinates) {
+			_writer.WriteRaw (jsonKeyId);
+			_writer.WriteString (_markerId);
+			_writer.WriteRaw (jsonKeyLat);
+			_writer.WriteInt32 (_coordinates.Item1);
+			_writer.WriteRaw (jsonKeyLng);
+			_writer.WriteInt32 (_coordinates.Item2);
+			_writer.WriteEndObject ();
+		}
+
+		protected override void HandleRestPost (RequestContext _context, IDictionary<string, object> _jsonInput, byte[] _jsonInputData) {
+			if (!TryGetJsonField (_jsonInput, "lat", out int lat)) {
+				SendErrorResult (_context, HttpStatusCode.BadRequest, _jsonInputData, "NO_OR_INVALID_LAT");
 				return;
 			}
 
-			if (!TryGetJsonField (bodyObject, "lat", out int lat)) {
-				SendEnvelopedResult (_context, null, HttpStatusCode.BadRequest, _jsonBody, "NO_OR_INVALID_LAT");
-				return;
-			}
-
-			if (!TryGetJsonField (bodyObject, "lng", out int lng)) {
-				SendEnvelopedResult (_context, null, HttpStatusCode.BadRequest, _jsonBody, "NO_OR_INVALID_LNG");
+			if (!TryGetJsonField (_jsonInput, "lng", out int lng)) {
+				SendErrorResult (_context, HttpStatusCode.BadRequest, _jsonInputData, "NO_OR_INVALID_LNG");
 				return;
 			}
@@ -77,21 +92,17 @@
 			markers.Add (newId, (lat, lng));
 
-			JsonString result = new JsonString (newId);
-			SendEnvelopedResult (_context, result, HttpStatusCode.Created);
+			PrepareEnvelopedResult (out JsonWriter writer);
+			writer.WriteString (newId);
+			SendEnvelopedResult (_context, ref writer, HttpStatusCode.Created);
 		}
 
-		protected override void HandleRestPut (RequestContext _context, JsonNode _jsonBody) {
-			if (!(_jsonBody is JsonObject bodyObject)) {
-				SendEnvelopedResult (_context, null, HttpStatusCode.BadRequest, _jsonBody, "BODY_NOT_OBJECT");
+		protected override void HandleRestPut (RequestContext _context, IDictionary<string, object> _jsonInput, byte[] _jsonInputData) {
+			if (!TryGetJsonField (_jsonInput, "lat", out int lat)) {
+				SendErrorResult (_context, HttpStatusCode.BadRequest, _jsonInputData, "NO_OR_INVALID_LAT");
 				return;
 			}
 
-			if (!TryGetJsonField (bodyObject, "lat", out int lat)) {
-				SendEnvelopedResult (_context, null, HttpStatusCode.BadRequest, _jsonBody, "NO_OR_INVALID_LAT");
-				return;
-			}
-
-			if (!TryGetJsonField (bodyObject, "lng", out int lng)) {
-				SendEnvelopedResult (_context, null, HttpStatusCode.BadRequest, _jsonBody, "NO_OR_INVALID_LNG");
+			if (!TryGetJsonField (_jsonInput, "lng", out int lng)) {
+				SendErrorResult (_context, HttpStatusCode.BadRequest, _jsonInputData, "NO_OR_INVALID_LNG");
 				return;
 			}
@@ -100,5 +111,5 @@
 
 			if (!markers.TryGetValue (id, out _)) {
-				SendEnvelopedResult (_context, null, HttpStatusCode.NotFound, _jsonBody, "ID_NOT_FOUND");
+				SendErrorResult (_context, HttpStatusCode.NotFound, _jsonInputData, "ID_NOT_FOUND");
 				return;
 			}
@@ -106,9 +117,13 @@
 			markers [id] = (lat, lng);
 
-			JsonObject result = new JsonObject ();
-			result.Add ("id", new JsonString (id));
-			result.Add ("lat", new JsonNumber (lat));
-			result.Add ("lng", new JsonNumber (lng));
-			SendEnvelopedResult (_context, result);
+			PrepareEnvelopedResult (out JsonWriter writer);
+			writer.WriteRaw (jsonKeyId);
+			writer.WriteString (id);
+			writer.WriteRaw (jsonKeyLat);
+			writer.WriteInt32 (lat);
+			writer.WriteRaw (jsonKeyLng);
+			writer.WriteInt32 (lng);
+			writer.WriteEndObject ();
+			SendEnvelopedResult (_context, ref writer);
 		}
 
@@ -116,5 +131,7 @@
 			string id = _context.RequestPath;
 
-			SendEnvelopedResult (_context, null, markers.Remove (id) ? HttpStatusCode.NoContent : HttpStatusCode.NotFound);
+			PrepareEnvelopedResult (out JsonWriter writer);
+			writer.WriteRaw (JsonEmptyData);
+			SendEnvelopedResult (_context, ref writer, markers.Remove (id) ? HttpStatusCode.NoContent : HttpStatusCode.NotFound);
 		}
 	}
