### Question:
Form { public Form add(FormEntry field) { entries.add(field); return this; } Form(); Form add(FormEntry field); List<FormEntry> getEntries(); void setEntries(List<FormEntry> entries);  }### Answer:
@Test void toJsonTest() { Form form1 = new Form(); form1.add(new FormLabelField("name", "Name").setRequired(true)); form1.add(new FormLabelField("age", "Age").setRequired(true).setValueType(FormLabelFieldValueType.INTEGER).setMinumumValue(0).setMaximumValue(120)); form1.add(new FormLabelField("remark", "Remark")); form1.add(new FormLabelField("language", "Language").addOption("en", "English").addOption("de", "Deutsch")); form1.add(new FormLabelField("directory", "Directory").setValueType(FormLabelFieldValueType.DIRECTORY)); String json = JsonUtils.toJson(form1); Form form2 = JsonUtils.fromJson(Form.class, json); assertForm(form1, form2); }