TX Text Control .NET Server

LoadDataFromJson Method

Method|Introduced in 24.0
Namespace
TXTextControl.Web.MVC
Package
TXTextControl.Web as TXTextControl.Web.DocumentEditor.dll from nuget.org, the private NuGet feed or Text Control Offline Packages

Description

Uses data given as a JSON string as a data source. The JSON string has to contain an array of equally structured objects. Analyzes and uses the given objects as merge data in the same way as the method LoadDataFromModel.

Syntax

public TextControl LoadDataFromJson(string json);

Parameters

ParameterDescription
json

The JSON string containing the merge data.

Return Value

A reference to the Web.MVC.TextControl instance to allow method chaining.

Examples

The following example uses TextControl.LoadDataFromJson in a document-processing workflow.

var result = textControl.LoadDataFromJson("{\"CustomerName\":\"Contoso Ltd.\"}");
Console.WriteLine(result);