Converter

RenderTo

RenderTo has four overloads. SaveTo(ref string) returns serialized output as a string directly into the caller's variable - the most common use. RenderTo(GPALFile) writes to a file, equivalent to SaveTo(GPALFile) for most formats. RenderTo(IGPALDatabase) inserts converted rows into a database table. RenderToClass(out dynamic) deserializes to a dynamic object when you do not have a strongly-typed target class - use SaveTo<T> instead when a typed class is available.

NOTE

For files and databases, RenderTo and SaveTo are functionally equivalent. The semantic distinction: RenderTo implies producing output in memory (string, dynamic object), SaveTo implies persisting to a named destination. Use whichever reads more clearly in context.

Examples

GPAL Fluent: High-level fluent C# API

//SaveTo(ref string) is the most frequently used overload - it is the standard way to get converted data as a string for logging, API responses, further processing, or display.

// To a string

string json;

GPAL.Converter

.WithInput(myGrid)

.WithOutputType(DataFormat.JSON)

.SaveTo(ref json);


// To a dynamic object (no typed class available)

dynamic result;

GPAL.Converter

.WithInput(GPAL.FileFor("data.json"))

.RenderToClass(out result);

Console.WriteLine(result.name);


// To a database

GPAL.Converter

.WithInput(GPAL.FileFor("data.csv"))

.WithFirstLineHasColumnNames(true)

.RenderTo(GPAL.Database

.WithConnectionString("...")

.ToGPALObject());

💬 Ask GPAL