I’m using bpmn.io for my project, there I have all the parameters in JSON format for each and every bpmn.io element separately, for example,
For BPMN Task
{
x:'45',
y:'55',
name:'abc',
.
.
.
etc;
}
all the JSON keys and values are matching to the bpmn.io diagram, now how can I display the bpmn.io diagram using these set of JSON, I cannot convert the JSON type to XML since I have separate JSON for each and every BPMN element, is there any other possibilities, please help me out.
I had a requirement, I need to show the bpmn diagram which is stored as separate, for each and every element, for a task ( example x, y, name,…etc) likewise each and every element has separate, so I need to show/display these elements in bpmn.io, please help me or give me a solution for this.
You got to write your own import facility as importing JSON is not built in.
At the core, import means the following:
Diagram document is parsed (we use moddle to do that)
Elements in the document are traversed in the order of appearance (BpmnTreeWalker)
Each encountered elements are rendered on the canvas (BpmnImporter)
I suggest you to follow the trace starting from Viewer#importXML and understand what is going on exactly. From there on it should be possible for you to re-build these component to provide a JSON importer.
We’d be interested in what you come up with, if you mind sharing it for educational reasons.
Thanks for the suggestion nikku, is there any way to dynamically generate the bpmn.io xml file, for example i’m having four bpmn task with its related values say x,y…etc stored in my DB, now can i generate the xml using these values to display four different bpmn task dynamically, any suggestions, please help me out.
It is possible to build such things. Our toolkit doesn’t include this functionality so you’d have to build it yourself. What’s the reasoning behind storing a diagram as JSON instead of XML?