You do not need to try to create the class structure manually.
Sometimes this is also quite unpleasant. :)
There is a Visual Studio command that you can use (I think vs2015 and later):
- In the new class file, click Menu => Edit => Paste Special
- Select "Insert JSON as Classes"
In particular, there is an error in your JSON; you are missing the closing curly brace of the first "element" object.
The following is the corrected JSON:
{ "action": "index.html", "method": "post", "elements": [ { "type": "fieldset", "caption": "User information", "elements": [ { "name": "email", "caption": "Email address", "type": "text", "placeholder": "Eg 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" } } ] } ] }
And the corresponding classes:
public class Rootobject { public string action { get; set; } public string method { get; set; } public Element[] elements { get; set; } } public class Element { public string type { get; set; } public string caption { get; set; } public Element1[] elements { get; set; } } public class Element1 { public string name { get; set; } public string caption { get; set; } public string type { get; set; } public string placeholder { get; set; } public Validate validate { get; set; } public string id { get; set; } public string _class { get; set; } public Options options { get; set; } } public class Validate { public bool email { get; set; } public bool required { get; set; } public int minlength { get; set; } public Messages messages { get; set; } public string equalTo { get; set; } } public class Messages { public string required { get; set; } public string minlength { get; set; } public string equalTo { get; set; } } public class Options { public string f { get; set; } public string m { get; set; } }