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

open function issue

open function is giving error "Unexpected token in JSON" when the data contains a tab character

EX: 
documenteditor.open('{"sections":[{"sectionFormat":{"pageWidth":612,"pageHeight":792,"leftMargin":72,"rightMargin":72,"topMargin":72,"bottomMargin":72,"differentFirstPage":false,"differentOddAndEvenPages":false,"headerDistance":36,"footerDistance":36,"bidi":false},"blocks":[{"paragraphFormat":{"styleName":"Normal","listFormat":{}},"characterFormat":{},"inlines":[{"characterFormat":{"bidi":false},"text":"This is test report"}]},{"paragraphFormat":{"styleName":"Normal","listFormat":{}},"characterFormat":{},"inlines":[{"characterFormat":{"bidi":false},"text":"by"},{"characterFormat":{"bidi":false},"text":"\t"},{"characterFormat":{"bidi":false},"text":"gvgj"},{"characterFormat":{"bidi":false},"text":"kundan"}]}],"headersFooters":{}}],"characterFormat":{"bold":false,"italic":false,"fontSize":11,"fontFamily":"Calibri","underline":"None","strikethrough":"None","baselineAlignment":"Normal","highlightColor":"NoColor","fontColor":"#000000","fontSizeBidi":11,"fontFamilyBidi":"Calibri"},"paragraphFormat":{"leftIndent":0,"rightIndent":0,"firstLineIndent":0,"textAlignment":"Left","beforeSpacing":0,"afterSpacing":0,"lineSpacing":1,"lineSpacingType":"Multiple","listFormat":{},"bidi":false},"defaultTabWidth":36,"styles":[],"lists":[],"abstractLists":[]}');

Please help. My editor is stuck. Don't know what to do.

3 Replies

RT Ramya Thirugnanam Syncfusion Team June 17, 2019 12:39 PM UTC

Hi Kundan, 
Thanks for contacting Syncfusion support. 
 
We have validated your issue. Before passing the json data into documenteditor open function, stringify the json data. Then it will open the content without any error.
  
 
Sample link:  

Sample code:
  
 
documenteditor.open(JSON.stringify({"sections":[{"sectionFormat":{"pageWidth":612,"pageHeight":792,"leftMargin":72,"rightMargin":72,"topMargin":72,"bottomMargin":72,"differentFirstPage":false,"differentOddAndEvenPages":false,"headerDistance":36,"footerDistance":36,"bidi":false},"blocks":[{"paragraphFormat":{"styleName":"Normal","listFormat":{}},"characterFormat":{},"inlines":[{"characterFormat":{"bidi":false},"text":"This is test report"}]},{"paragraphFormat":{"styleName":"Normal","listFormat":{}},"characterFormat":{},"inlines":[{"characterFormat":{"bidi":false},"text":"by"},{"characterFormat":{"bidi":false},"text":"\t"},{"characterFormat":{"bidi":false},"text":"gvgj"},{"characterFormat":{"bidi":false},"text":"kundan"}]}],"headersFooters":{}}],"characterFormat":{"bold":false,"italic":false,"fontSize":11,"fontFamily":"Calibri","underline":"None","strikethrough":"None","baselineAlignment":"Normal","highlightColor":"NoColor","fontColor":"#000000","fontSizeBidi":11,"fontFamilyBidi":"Calibri"},"paragraphFormat":{"leftIndent":0,"rightIndent":0,"firstLineIndent":0,"textAlignment":"Left","beforeSpacing":0,"afterSpacing":0,"lineSpacing":1,"lineSpacingType":"Multiple","listFormat":{},"bidi":false},"defaultTabWidth":36,"styles":[],"lists":[],"abstractLists":[]}));  
  
Regards, 
Ramya T 



KU Kundan June 17, 2019 02:21 PM UTC

A big thanks.


RT Ramya Thirugnanam Syncfusion Team June 18, 2019 05:23 AM UTC

Hi Kundan 
 
Thanks for your update. 
 
Regards,
Ramya T
 


Loader.
Live Chat Icon For mobile
Up arrow icon