© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
3 replies
SWEETPONY

❔ How to create json schema by class?

I have following class:
internal class ReportGenerateParameters
{
    [JsonProperty(PropertyName = "departments_ids")]
    public HashSet<string> DepartmentIDs { get; set; }

    [JsonProperty(PropertyName = "page_break_after_department")]
    public bool PageBreakAfterDepartment { get; set; } = true;

    [JsonProperty(PropertyName ="show_subjects_of_nested_departments")]
    public bool ShowSubjectsOfNestedDepartments { get; set; }
}
internal class ReportGenerateParameters
{
    [JsonProperty(PropertyName = "departments_ids")]
    public HashSet<string> DepartmentIDs { get; set; }

    [JsonProperty(PropertyName = "page_break_after_department")]
    public bool PageBreakAfterDepartment { get; set; } = true;

    [JsonProperty(PropertyName ="show_subjects_of_nested_departments")]
    public bool ShowSubjectsOfNestedDepartments { get; set; }
}

And I can create manually json schema using this class, it will look in following way:
https://gist.github.com/INTERNALINTERFERENCE/ca09a767eb4027c593416ae8ff155274

I'd like to automate generating of this json. How can I do it? Can someone give some information about this?
Gist
.json
GitHub Gist: instantly share code, notes, and snippets.
.json
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Deserializing Json to class
C#CC# / help
3y ago
❔ how to create a class equivalent to another
C#CC# / help
3y ago
❔ How to create class like MonoBehaviour from Unity
C#CC# / help
3y ago
❔ How to create a subpage by code
C#CC# / help
3y ago