OfficeIMO.Data.Conversions
3.6.2
Prefix Reserved
dotnet add package OfficeIMO.Data.Conversions --version 3.6.2
NuGet\Install-Package OfficeIMO.Data.Conversions -Version 3.6.2
<PackageReference Include="OfficeIMO.Data.Conversions" Version="3.6.2" />
<PackageVersion Include="OfficeIMO.Data.Conversions" Version="3.6.2" />
<PackageReference Include="OfficeIMO.Data.Conversions" />
paket add OfficeIMO.Data.Conversions --version 3.6.2
#r "nuget: OfficeIMO.Data.Conversions, 3.6.2"
#:package OfficeIMO.Data.Conversions@3.6.2
#addin nuget:?package=OfficeIMO.Data.Conversions&version=3.6.2
#tool nuget:?package=OfficeIMO.Data.Conversions&version=3.6.2
OfficeIMO.Data.Conversions
Streaming conversions between JSON, JSON Lines, YAML, TOML, XML, CSV and TSV. Data flows from each format's own reader to the target's writer as events, so a large file converts with bounded memory. Numbers keep their exact text (1.10, 23-digit integers), and everything a target cannot carry is reported in OfficeConversionReport.
Worksheets are in OfficeIMO.Data.Conversions.Excel. The OfficeIMO package includes both, so OfficeConverter.Convert("a.yaml", "a.json") works with one reference.
Install
dotnet add package OfficeIMO.Data.Conversions
Convert documents
using System.Text.Json.Nodes;
using System.Xml.Linq;
using OfficeIMO.CSV;
using OfficeIMO.Data.Conversions;
using OfficeIMO.Toml;
using OfficeIMO.Yaml;
YamlDocument values = YamlDocument.Load("values.yaml");
JsonNode? json = values.ToJson();
OfficeConversionReport report = values.SaveAsJson("values.json");
XDocument.Load("orders.xml").SaveAsJson("orders.json");
JsonNode.Parse(File.ReadAllText("app.json"))!.SaveAsYaml("app.yaml"); // strings YAML 1.1 would retype are quoted
CsvDocument.Load("people.csv").SaveAsJson("people.jsonl"); // JSON Lines from the extension
TomlDocument cargo = TomlDocument.Load("Cargo.toml");
cargo.SaveAsYaml("cargo.yaml"); // comments travel with their keys
TomlDocument config = JsonNode.Parse(File.ReadAllText("config.json"))!.ToToml(null, out OfficeConversionReport tomlReport);
TomlDocument.Load("Cargo.lock").SaveAsCsv("packages.tsv", new DataConversionOptions { Select = "package" }); // TSV from the extension
JsonNode response = JsonNode.Parse(File.ReadAllText("response.json"))!;
response.SaveAsCsv("items.csv", new DataConversionOptions { Select = "data.items" });
Every To{Target} method has an overload with out OfficeConversionReport report. Set DataConversionOptions.FailOnLoss to throw OfficeConversionException instead of writing output when anything is lost.
Read rows as a data reader
StructuredDataReader exposes the rows of JSON, JSON Lines, YAML, TOML or XML as a DbDataReader, for SqlBulkCopy, OfficeIMO.Data.Arrow, DataTable.Load or ExcelSheet.InsertDataReader.
using System.Data;
using OfficeIMO.Data.Conversions;
using StructuredDataReader rows = StructuredDataReader.Open("orders.json", new DataConversionOptions { Select = "data.items" });
var table = new DataTable();
table.Load(rows); // columns such as id, customer.name and lines[0].sku, typed from the data
The input is read twice: once to find the columns and their types, then to stream the rows.
Mapping
- Rows come from an array: the root, each document of a YAML stream or JSON Lines file, or the path in
Select. A root object whose members are all arrays is several tables (NextResult, or one sheet each in Excel). - Columns are paths:
address.city,tags[0].ArrayColumns = Joinputs scalar arrays in one cell instead. Path headers rebuild nested data on the way back. - CSV and TSV types are inferred per column from canonical spellings only, so
007,+1,1,000andyesstay text. - TSV uses the
CsvProfile.Tsvdialect: tab-separated, no quoting, so quotes are data. A value containing a tab or line break fails the conversion unlessCsvSaveselectsCsvEscapeMode.Backslash. A.tsvor.tabpath selects TSV forSaveAsCsvandOfficeConverter. - TOML tables are objects and arrays of tables are arrays; integers, floats and booleans keep their types, and the four date-time kinds stay typed in TOML output and become RFC 3339 text in JSON, YAML and XML. Writing TOML reports what it cannot hold: nulls are omitted, integers beyond 64 bits and floats beyond
doublebecome strings, a root that is not an object is wrapped inRootName(root), and values that followed a nested object move ahead of its[table]section, because TOML writes a table's values first. Comments directly above a key or header, and after a value, travel to and from YAML and XML; other TOML comments are reported as dropped. - XML follows one convention: the root element is the single top-level key, attributes are
@name, text beside attributes or elements is#text, repeated elements are arrays andxsi:nil="true"is null. DTDs are prohibited. - YAML follows the document's schema: YAML 1.1 timestamps and merge keys apply only under
%YAML 1.1or a forced schema. Aliases are expanded withinMaxAliasExpansion.
The structured-data conversions design lists every mapping rule and loss code.
Generated capability summary
This table is generated from the package-neutral OfficeIMO operation catalog. The detailed source contracts remain authoritative for feature-level behavior and limitations.
| Operation | Supported | Partial | Preserved | Rejected | Unsupported | Not applicable |
|---|---|---|---|---|---|---|
| Convert | 0 | 40 | 0 | 0 | 0 | 0 |
The complete rows for OfficeIMO.Data.Conversions are published in the generated operation contract.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.9)
- OfficeIMO.Core (>= 3.6.2)
- OfficeIMO.CSV (>= 3.6.2)
- OfficeIMO.Toml (>= 3.6.2)
- OfficeIMO.Yaml (>= 3.6.2)
- System.Text.Json (>= 10.0.9 && < 11.0.0)
-
.NETStandard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.9)
- OfficeIMO.Core (>= 3.6.2)
- OfficeIMO.CSV (>= 3.6.2)
- OfficeIMO.Toml (>= 3.6.2)
- OfficeIMO.Yaml (>= 3.6.2)
- System.Text.Json (>= 10.0.9 && < 11.0.0)
-
net10.0
- OfficeIMO.Core (>= 3.6.2)
- OfficeIMO.CSV (>= 3.6.2)
- OfficeIMO.Toml (>= 3.6.2)
- OfficeIMO.Yaml (>= 3.6.2)
-
net8.0
- OfficeIMO.Core (>= 3.6.2)
- OfficeIMO.CSV (>= 3.6.2)
- OfficeIMO.Toml (>= 3.6.2)
- OfficeIMO.Yaml (>= 3.6.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on OfficeIMO.Data.Conversions:
| Package | Downloads |
|---|---|
|
OfficeIMO
Document conversion and resumable batches over the OfficeIMO format libraries. |
|
|
OfficeIMO.Data.Conversions.Excel
Excel worksheets in OfficeIMO structured-data conversions: worksheets and workbooks to JSON, JSON Lines, YAML, TOML and XML, and JSON, YAML, TOML and XML rows to workbooks. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.6.2 | 66 | 11/18/2026 |