Converter

WithInputType

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.

NOTE

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

💬 Ask GPAL