I was wondering if anyone knows of any utilities that will generate a C# class from JSON but is also able to assign and maintain property values. I am not looking for a parser, serializer or deserilizer, eg JsonNet. rather something that can take in a static JSON string and retun a static C# class like these two below utils.

I know that QuickType does generate the class structure itself, but I also need to maintain the data as I intend to generate big classes from an existing system and use them as inputs into my tests. my objects are quite big and I want to save myself the trouble of having to manually reassign those property values.

example JSON:

{"employees": [
                        {  "firstName":"John" , "lastName":"Doe" },

C# output:

public class Employee
    public string FirstName { get; set; }
    public string LastName { get; set; }

public class Example
    public IList<Employee> employees = new List<Employee>{
       new Employee { FirstName ="John", LastName = "Doe" }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.