AlwaysGenerateRootObject
Contents
[
Hide
]JsonDataLoadOptions.AlwaysGenerateRootObject property
Gets or sets a flag indicating whether a generated data source will always contain an object for a JSON root element. If a JSON root element contains a single complex property, such an object is not created by default.
public bool AlwaysGenerateRootObject { get; set; }
Remarks
The default value is false
.
Examples
Shows how to use JSON as a data source (string).
Document doc = new Document(MyDir + "Reporting engine template - JSON data destination.docx");
JsonDataLoadOptions options = new JsonDataLoadOptions
{
ExactDateTimeParseFormats = new List<string> {"MM/dd/yyyy", "MM.d.yy", "MM d yy"},
AlwaysGenerateRootObject = true,
PreserveSpaces = true,
SimpleValueParseMode = JsonSimpleValueParseMode.Loose
};
JsonDataSource dataSource = new JsonDataSource(MyDir + "List of people.json", options);
BuildReport(doc, dataSource, "persons");
doc.Save(ArtifactsDir + "ReportingEngine.JsonDataString.docx");
See Also
- class JsonDataLoadOptions
- namespace Aspose.Words.Reporting
- assembly Aspose.Words