KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a complex JSON object that I want represent as C# class. I have a head start on the parent class called "Form", but how can I represent a collection for different types (see the "elements" object below)? Here is the JSON object: { "action": "index.html", "method": "post", "elements": [ { "type": "fieldset", "caption": "User information", "elements": [ { "name": "email", "caption": "Email address", "type": "text", "placeholder": "E.g. user@example.com", "validate": { "email": true } }, { "name": "password", "caption": "Password", "type": "password", "id": "registration-password", "validate": { "required": true, "minlength": 5, "messages": { "required": "Please enter a password", "minlength": "At least {0} characters long" } } }, { "name": "password-repeat", "caption": "Repeat password", "type": "password", "validate": { "equalTo": "#registration-password", "messages": { "equalTo": "Please repeat your password" } } }, { "type": "radiobuttons", "caption": "Sex", "name": "sex", "class": "labellist", "options": { "f": "Female", "m": "Male" } } ] ] } The class I have start looks like this: public class Form { public Guid id { get; set; } public string action { get; set; } public string
Tags (comma-separated)
Save Edits
Cancel