SimpleValueParseMode

JsonDataLoadOptions.SimpleValueParseMode property

Ruft einen Modus für die Analyse einfacher JSON-Werte (Null, Boolean, Zahl, Integer und String) beim Laden von JSON ab oder legt ihn fest. Dieser Modus hat keinen Einfluss auf die Analyse von Datums- und Uhrzeitwerten. Der Standardwert ist Loose .

public JsonSimpleValueParseMode SimpleValueParseMode { get; set; }

Beispiele

Zeigt, wie JSON als Datenquelle (Zeichenfolge) verwendet wird.

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");

Siehe auch