Bpmn 2.0 xml to JSON format

Hello everyone,
How can i convert the bpmn xml document to JSON,
is there an implementaion for that?
Thanks in advance.
Kind regards


There no specific implementation for that, as there is no standard or schema to adhere to for JSON BPMN 2.0 representation. You, probably, have two main options:

  • Export XML (modeler.saveXML(...)) and convert it using some external XML-to-JSON tool/library
  • Export object, defined by bpmn-moddle, like this:
var definitions = modeler.get('canvas').getRootElement().businessObject.$parent;


1 Like

Thank you again Vladmirs, is it possible to transform a bpmn xml to a relational object table, i mean map the bpmn xml to database tables so i can recontruct the xml from the database and vice versa.

Thank you.


Well, that is something very custom and really depends on how do want to break it down - i.e. the mapping itself.

Mapping BPMN 2.0 XML to some other format would effectively create some sort of custom non-standard way to represent BPMN semantics.

What is your use case? What are main drivers to not store XML as a whole?



In my case, i need to implement a complex workflow in my applications which contains of predefined states
and i have to store all the workflows (states, transitions) and map the users allowed to execute the tranansition in database, also according to the state we will execute an action (event).


The use case is not quite clear to me, in terms of what exactly needs to be manipulated in the XML of a diagram.
But does sound like you would need to create some sort of XML templating solution.

I do not think there is a generic solution for BPMN 2.0 that you could use out of the box.


The reason you’d typically want the BPMN 2.0 XML representation is that it is standardized, too and may be executed by workflow engines such as Camunda.

Unless your diagrams are super simple you almost never want to implement such an engine yourself. Trust me :wink:.