Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsonPropertyName attribute does not work with Array of Tables #86

Open
mister-mist opened this issue Aug 20, 2024 · 0 comments
Open

JsonPropertyName attribute does not work with Array of Tables #86

mister-mist opened this issue Aug 20, 2024 · 0 comments

Comments

@mister-mist
Copy link

JsonPropertyName attribute can be used with basic Table but with Array of Tables the following errors occur

  • error : Unable to set the property myTables on object type MyDto
  • error : The property myKey was not found on object type MyTable
    public void Test1()
    {
        const string toml = """
                            [[myTables]]
                            myKey = 1 
                            myValue = "val"
                            """;

        var model = Toml.ToModel<MyDto>(toml);
    }
public class MyDto
{
        
        [JsonPropertyName("myTables")]
        public ICollection<MyTable> MyTables { get; set; } = [];

}

public class MyTable
{
        [JsonPropertyName("myKey")]
        public string MyKey { get; set; }
        [JsonPropertyName("myValue")]
        public string MyValue { get; set; }
        
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant