using System.Collections.Generic;
public class ContractBalance
public string DataAreaID {get; set;}
public string ContractNumber {get; set;}
public List<ContractBalanceMonth> MonthQuantities {get; set;}
public class ContractBalanceMonth
public int Month {get; set;}
public int Year {get; set;}
public decimal ScheduledQty {get; set;}
public decimal OrderedQty {get; set;}
public decimal ShippedQty {get; set;}
public decimal InvoicedQty {get; set;}
public decimal CreditQty {get; set;}
public decimal AvailableQty => ScheduledQty - Math.Max(OrderedQty, ShippedQty) + CreditQty;
public static void Main()
var opt = new JsonSerializerOptions
AllowTrailingCommas = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
ReadCommentHandling = JsonCommentHandling.Skip,
PropertyNameCaseInsensitive = true,
var obj = new ContractBalance
ContractNumber = "1112223",
MonthQuantities = new List<ContractBalanceMonth>
Console.WriteLine(JsonSerializer.Serialize(obj, opt));