JsonSimpleValueParseMode Enum
Wordize.Reporting.JsonSimpleValueParseMode enum. Specifies a mode for parsing JSON simple values null boolean number integer and string while loading JSON. Such a mode does not affect parsing of datetime values.
JsonSimpleValueParseMode enumeration
Specifies a mode for parsing JSON simple values (null, boolean, number, integer, and string) while loading JSON. Such a mode does not affect parsing of date-time values.
public enum JsonSimpleValueParseMode
Values
Name | Value | Description |
---|---|---|
Loose | 0 | Specifies the mode where types of JSON simple values are determined upon parsing of their string representations. For example, the type of ‘prop’ from the JSON snippet ‘{ prop: “123” }’ is determined as integer in this mode. |
Strict | 1 | Specifies the mode where types of JSON simple values are determined from JSON notation itself. For example, the type of ‘prop’ from the JSON snippet ‘{ prop: “123” }’ is determined as string in this mode. |
Examples
Shows how to specify simple value parse mode.
string templateString = "Number: <<[Number]>>";
string jsonString = "{ Number : \"0000123\" }";
JsonDataLoadOptions jsonLoadOptions = new JsonDataLoadOptions();
// In Strict simple value parse mode value in { Number : "0000123" } JSON
// is considered as a string and leading zeros are preserve.
jsonLoadOptions.SimpleValueParseMode = JsonSimpleValueParseMode.Strict;
JsonDataSource ds = new JsonDataSource(new MemoryStream(Encoding.UTF8.GetBytes(jsonString)), jsonLoadOptions);
ReportBuilderContext context = new ReportBuilderContext();
context.DataSources.Add(ds, "");
ReportBuilder.Create(context)
.From(new MemoryStream(Encoding.UTF8.GetBytes(templateString)))
.To(ArtifactsDir + "JsonDataLoadOptions.SimpleValueParseMode.docx")
.Execute();
See Also
- namespace Wordize.Reporting
- assembly Wordize