<PackageReference Include="Microsoft.ApplicationInsights" Version="2.23.0" />

Microsoft.ApplicationInsights.Extensibility.Implementation.JsonSerializer

public static class JsonSerializer
Serializes and compress the telemetry items into a JSON string. Compression will be done using GZIP, for Windows Phone 8 compression will be disabled because there is API support for it.
public static string CompressionType { get; }

Gets the compression type used by the serializer.

public static string ContentType { get; }

Gets the content type used by the serializer.

public static byte[] ConvertToByteArray(string telemetryItems, bool compress = true)

Converts serialized telemetry items to a byte array.

public static string Deserialize(byte[] telemetryItemsData, bool compress = true)

Deserializes and decompress the telemetry items into a JSON string.

public static byte[] Serialize(IEnumerable<ITelemetry> telemetryItems, bool compress = true)

Serializes and compress the telemetry items into a JSON string. Each JSON object is separated by a new line.