Unable to post nested object to server

I have a list of products associated with a customer and I am trying to send the customer with products to be created. When I do that the list of products is removed by "Radzen.ODataJsonSerializer.Serialize" method when sending to the server.

public class Customer
{
    public string Name { get; set; }
    public List<Product> Products { get; set; }
}

public class Product
{
    public string Name { get; set; }
}

Customer c = new();
c.Name = "Test Customer";
c.Products = new List<Product>();
c.Products.Add(new Product { Name = "Test Product" });

//{"Name":"Test Customer"}
Console.WriteLine(Radzen.ODataJsonSerializer.Serialize(c));

//{ "Name":"Test Customer","Products":[{ "Name":"Test Product"}]}
Console.WriteLine(JsonSerializer.Serialize(c));

Not supported by OData - parameters can be only primitive types.

1 Like

Ok. That explains it. We can use a serialized text property to implement the requirement. Thanks!