@dkayiwa this class only handles XML not JSON https://github.com/openmrs/openmrs-module-htmlformentry/blob/6285025297ac7423f6cfba697a2b7bd6961545d3/api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryUtil.java
I am trying to replicate what is needed to setup a form resource for this JSON
for this JSON
{ “name”: “My Form”, “uuid”: “7ce5eb4d-722c-46e4-a6ef-05fa34feaa6e”, “processor”: “EncounterFormProcessor”, “pages”: [ { “label”: “”, “sections”: [ { “label”: “Label 1”, “questions”: [ { “type”: “obsGroup”, “label”: “Details of the past Screening”, “questionOptions”: { “rendering”: “group”, “concept”: “138405AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA” }, “questions”: [ { “label”: “Question 1”, “questionOptions”: { “rendering”: “radio”, “concept”: “138405AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “answers”: [ { “concept”: “1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “Yes” }, { “concept”: “1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “No” }, { “concept”: “1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “Unknown” } ] }, “type”: “obs”, “validators”: }, { “label”: “Does the patient have any symptoms?”, “questionOptions”: { “rendering”: “radio”, “concept”: “1729AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “answers”: [ { “concept”: “1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “Yes” }, { “concept”: “1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “No” }, { “concept”: “1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “Unknown” } ] }, “type”: “obs”, “validators”: } ] } ] } ] } ] }
to extract the details which are used to build the following equivalent SQL
insert into form_resource (form_id, name, value_reference, datatype, datatype_config, preferred_handler, handler_config, uuid, date_changed, changed_by) values (6, ‘json’, ‘{ “name”: “My Form”, “uuid”: “7ce5eb4d-722c-46e4-a6ef-05fa34feaa6e”, “processor”: “EncounterFormProcessor”, “pages”: [ { “label”: “”, “sections”: [ { “label”: “Label 1”, “questions”: [ { “type”: “obsGroup”, “label”: “Details of the past Screening”, “questionOptions”: { “rendering”: “group”, “concept”: “138405AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA” }, “questions”: [ { “label”: “Question 1”, “questionOptions”: { “rendering”: “radio”, “concept”: “138405AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “answers”: [ { “concept”: “1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “Yes” }, { “concept”: “1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “No” }, { “concept”: “1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “Unknown” } ] }, “type”: “obs”, “validators”: }, { “label”: “Does the patient have any symptoms?”, “questionOptions”: { “rendering”: “radio”, “concept”: “1729AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “answers”: [ { “concept”: “1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “Yes” }, { “concept”: “1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “No” }, { “concept”: “1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “label”: “Unknown” } ] }, “type”: “obs”, “validators”: } ] } ] } ] } ] }’, ‘org.openmrs.customdatatype.datatype.FreeTextDatatype’, null, null, null, ‘d0b8ab1c-196e-4bcc-9cae-b6477bcc0153’, null, null);