We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to export the contents of documenteditor to json?


Hello.

I want to export the contents of documenteditor to json and store it in my database.

There was no way to export the manual for documenteditor export to json.

Please let me know if there is a way to do documenteditor.toJson (), as opposed to documenteditor.open ().

1 Reply

MA Mugunthan Anbalagan Syncfusion Team January 16, 2019 12:12 PM UTC

Hi John, 

Thank you for contacting Syncfusion support. 

In our DocumentEditor control, we can obtain the content in the form of Json by using `saveAsBlob` method. 
  
Sample Code 
documenteditor.saveAsBlob('Sfdt').then(function (sfdtBlob) { 
    var fileReader = new FileReader(); 
    fileReader.onload = function (e) { 
        // Get Json string here 
        var sfdtText = fileReader.result; 
       // This string can send to server for saving it in database 
        alert(sfdtText); 
    } 
    fileReader.readAsText(sfdtBlob); 
  }); 
 
We have prepared a sample to demonstrate this. Please do find the sample from below link.  
  
  
Kindly try this solution and let us know if this helps you. 

Regards, 
Mugunthan A 


Loader.
Live Chat Icon For mobile
Up arrow icon