public static ReadOnlyMemory <byte> SerializeRequestBody(ConfigurationSetting setting) { var writer = new Core.ArrayBufferWriter <byte>(); using var json = new Utf8JsonWriter(writer); json.WriteStartObject(); WriteRequestBody(json, setting); json.WriteEndObject(); json.Flush(); return(writer.WrittenMemory); }
public static ReadOnlyMemory <byte> SerializeEncryptedMessage(EncryptedMessage message) { var writer = new Core.ArrayBufferWriter <byte>(); using var json = new Utf8JsonWriter(writer); json.WriteStartObject(); WriteEncryptedMessage(json, message); json.WriteEndObject(); json.Flush(); return(writer.WrittenMemory); }
/// <summary> /// Serializes an EncryptionData instance into JSON. /// </summary> /// <param name="data">Data to serialize.</param> /// <returns>The JSON UTF8 bytes.</returns> private static ReadOnlyMemory <byte> SerializeEncryptionData(EncryptionData data) { var writer = new Core.ArrayBufferWriter <byte>(); using var json = new Utf8JsonWriter(writer); json.WriteStartObject(); WriteEncryptionData(json, data); json.WriteEndObject(); json.Flush(); return(writer.WrittenMemory); }