跳到主要内容

FromJSON

Converts the specified JSON object into the Document Builder object of the corresponding type.

Syntax

expression.FromJSON(message);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
messageRequiredJSONThe JSON object to convert.

Returns

This method doesn't return any data.

Example

This example transforms paragraph to JSON then restore it from JSON.

let paragraph = Api.CreateParagraph();
paragraph.AddText("This is a new paragraph");
let json = paragraph.ToJSON(false, true);
let paragraphFromJSON = Api.FromJSON(json);
paragraphFromJSON.SetBold(true);
Api.GetDocument().AddElement(0, paragraphFromJSON);