How to load EJ1 diagram in EJ2 diagram

1 Jan 20251 minute to read

To load EJ1 JSON data in an EJ2 diagram, follow these steps.

  1. Import and inject the EJ1SerializationModule as shown in the following code example.
import { Diagram } from '@syncfusion/ej2-diagrams';
import { EJ1SerializationModule } from '@syncfusion/ej2-diagrams';
Diagram.Inject(EJ1SerializationModule);
  1. Load the EJ1 JSON data using the diagram loadDiagram method and set the second parameter to true.
var ej1Data = {"JSONData"};  // Replace JSONData with your EJ1 JSON data
//Load the EJ1 JSON and pass boolean value as true
var diagram = document.getElementById('diagram').ej2_instances[0];
diagram.loadDiagram(ej1Data, true);