Converter

WithInputType

Explicitly sets the format of the input data. Use when format cannot be auto-detected from a file extension or string content, or to override GPAL's detection.

Explicitly sets the format of the input data. Use when format cannot be auto-detected from a file extension or string content, or to override GPAL's detection.

GPAL auto-detects format in most cases. WithInputType is needed when the source is a raw string with no structural cue, when a file has an unexpected extension, or when you want to force a specific parse path. The DataFormat enum covers all formats GPAL supports on both input and output.

TIP

JSON, YAML, CSV, XML, HTML, BASE64, DATABASE, EXCEL, GRID, PDF, CLASS, TAB, PIPE. Not all formats are valid for all input sources - for example, PDF is input-only.

Examples

GPAL Fluent: High-level fluent C# API

//WithInputType and WithOutputType are independent - you can combine any supported input format with any supported output format in a single chain.

// Force YAML parse on a string that could be ambiguous string result; GPAL.Converter .WithInput(rawString) .WithInputType(DataFormat.YAML) .WithOutputType(DataFormat.JSON) .SaveTo(ref result); // Force CSV parse on a file with a non-standard extension GPAL.Converter .WithInput(GPAL.FileFor("export.txt")) .WithInputType(DataFormat.CSV) .WithFirstLineHasColumnNames(true) .WithOutputType(DataFormat.JSON) .SaveTo(ref result);