Convert XML into JSON format for element templates

Is there any way to convert XML file full of bpmn tasks into tasks in JSON format to feed in for making element templates?

The .bpmn file I have, has many such tasks in it:

<bpmn:callActivity id=“proposalUnderwriting_P1” name=“Underwriting (LT)” calledElement=“ProposalUnderwritingTask_DemoP1”>
bpmn:extensionElements
<camunda:in variables=“all” />
<camunda:out variables=“all” />
<camunda:in businessKey=“#{proposalId}” />
</bpmn:extensionElements>
</bpmn:callActivity>

when I convert it into .json format for feeding in as element template it looks something similar (not exactly) to this:

{
        "$schema": "https://unpkg.com/@camunda/element-templates-json-schema/resources/schema.json",
        "name": "Underwriting (LT)",
        "id": "proposalUnderwriting_P1",
        "version": 1,
        "description": "Underwriting (LT) call activity",
        "category": {
            "id": "distribution",
            "name": "Distribution"
        },
        "appliesTo": ["bpmn:CallActivity"],
        "properties": [
            {
                "label": "Business Key",
                "type": "String",
                "binding": {
                    "type": "camunda:in",
                    "businessKey": "${proposalId}"
                }
            },
            {
                "label": "Input all",
                "type": "Hidden",
                "binding": {
                    "type": "camunda:in",
                    "variables": "all"
                }
            },
            {
                "label": "Output all",
                "type": "Hidden",
                "binding": {
                    "type": "camunda:out",
                    "variables": "all"
                }
            }
        ]
    }

Is there any way to programmatically convert a task in .bpmn format into a task in .json format for feeding as element template.

I came across some posts around converting XML to JSON but they were obsolete, so I thought to ask this again. May be they were asked in a different context than element templates.

I used ChatGPT to help me convert XML to JSON. At first I had to give ChatGPT few examples of conversion and then it very intelligently picked up on how to convert XML to JSON.

Then I kept feeding it inputs one by one and got results back. As of now I am not aware of any other solution, hence marking this as the solution.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.