Defines two packet types for the APLib protocol: PrintJSONPacket which is a packet carrying an array of PrintJSONPart, and PrintJSONPart which holds a single Text string. The packet sets a Command property to "PrintJSON" and serializes fields with System.Text.Json names.
using System.Text.Json.Serialization;
namespace APLib.Protocol.Packets;
public sealed class PrintJSONPacket : APPacket
{
[JsonPropertyName( "PrintJSON" )]
public override string Command => "PrintJSON";
[JsonPropertyName( "data" )]
public PrintJSONPart[] Data { get; set; } = [];
}
public sealed class PrintJSONPart
{
[JsonPropertyName( "text" )]
public string Text { get; set; }
}