Convert to XML or JSON data with advanced options

GroupDocs.Conversion provides the WebConvertOptions class to give you control over the conversion result while converting to JSON, XML or other web data formats. To convert your document to XML or JSON format, specify the desired format using the Format property.

The following code snippet shows how to convert a CSV spreadsheet to JSON format:

using (Converter converter = new Converter("sample.csv"))
{
    WebConvertOptions options = new WebConvertOptions
    {
        Format = WebFileType.Json
    };
    converter.Convert("converted.json", options);
}
Note
Before version 22.12, the XML and JSON formats were specified using the DataConvertOptions class:
using (Converter converter = new Converter("sample.csv"))
{
    DataConvertOptions options = new DataConvertOptions
    {
        Format = DataFileType.Json
    };
    converter.Convert("converted.json", options);
}