When I tried to TOJSON a paragraph with a Heading style (retaining style) and then FROMJSON, I got an error
var oNewDocumentStyle = oDocument.GetStyle(“Heading 1”);
oParagraph.SetStyle(oNewDocumentStyle);
var json = oParagraph.ToJSON(true,true);
var fjson = Api.FromJSON(json);
In fact, the problem I encountered was that if I TOJSON the document and then FROMJSON,
it would lose all the Heading style (the styles are all the same, but just the Heading style are missing).
I tried many methods, but none of them worked
var json = oDocument.ToJSON(true,true,true,true,true);
var fjson = Api.FromJSON(json);
oDocument.RemoveAllElements();
oDocument.InsertContent(fjson);