ExactDateTimeParseFormats
Contents
[
Hide
]JsonDataLoadOptions.ExactDateTimeParseFormats property
Gets or sets exact formats for parsing JSON date-time values while loading JSON. The default is null
.
public IEnumerable<string> ExactDateTimeParseFormats { get; set; }
Remarks
Strings encoded using Microsoft® JSON date-time format (for example, “/Date(1224043200000)/”) are always recognized as date-time values regardless of a value of this property. The property defines additional formats to be used while parsing date-time values from strings in the following way:
- When
ExactDateTimeParseFormats
isnull
, the ISO-8601 format and all date-time formats supported for the current, English USA, and English New Zealand cultures are used additionally in the mentioned order. - When
ExactDateTimeParseFormats
contains strings, they are used as additional date-time formats utilizing the current culture. - When
ExactDateTimeParseFormats
is empty, no additional date-time formats are used.
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