using System.Collections;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;
using System.Text.Json.Nodes;
public int Id { get; set; }
public IEnumerable<byte>? Data { get; set; }
public static void Test()
var options = new JsonSerializerOptions { };
MyModel myObject = new MyModel
Data = new byte[] { 0x01, 0x02, 0x03 }
string json = JsonSerializer.Serialize(myObject, options);
public static void Main()
Console.WriteLine("Environment version: {0} ({1}), {2}", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription , Environment.Version, Environment.OSVersion);
Console.WriteLine("System.Text.Json version: " + typeof(JsonSerializer).Assembly.FullName);
Console.WriteLine("Failed with unhandled exception: ");