How to use bpmn.js in my scenario?

Hello everyone!I have read the walkthrough of, and I think that the system’s input and output is all xml of bpmn2, right?We use bpmnModeler.importXML to transfer xml string to diagram.
But now I want to reander a JSON object from backend to diagram and transfer the diagram to an object when user save,so the system’s input and output is object now.
Can someone tell me whether bpmn.js is suitable for this scenario and how to do? Thanks a lot.

Basically saying, the library always consumes xml to render diagrams. Internally, it saves all the information it gets from the xml to an object tree (cf. documentation).

However, this is internal. On import and export purposes, it will always deal with xml. So JSON objects are not intended to work with the toolkit. More or less, you will have to parse your JSON to valid bpmn xml. This is what bpmn-moddle does with the internal object schema.

And the shapes and lines may need to do some customization

How is your JSON related to BPMN?

We use the internal framework for redering diagrams before, but it was abandoned.We pass the object to a component called diagram, then we got it.And we pass the object to backend when user save the diagrams, the relation or transfer between object and bpmn is dealed in our backed