JSON 转换器

Sheetize JSON Converter for .NET 提供强大的功能,将文档转换为和从JSON格式,使易于集成到网页应用程序和数据处理工作流。

主要特点

文件到 JSON 转换

将文档(例如 PDF、DOCX)转换为 JSON 格式,以便以结构化形式提取内容,进行进一步分析或集成。

JSON 到文档转换

将 JSON 数据转换为 PDF 或 DOCX 等文档格式,可轻松报告生成或文件自动化。

详细指南

将文件转换为 JSON

将文件转换为 JSON:

  • 启动转换器 :创建一个例子 JsonConverter.
  • 设置转换选项 :使用 DocumentToJsonOptions 要设置文件在 JSON 中如何呈现。
  • 定义输入和输出路径 : 设置输送文件和 JSON 文件的路线。
  • 执行转换 :呼叫 Process 转换文档的方法。

例如:将 PDF 转换为 JSON

// Step 1: Initialize the JSON Converter
var converter = new JsonConverter();

// Step 2: Configure options for Document to JSON conversion
var options = new DocumentToJsonOptions();
options.IncludeMetadata = true; // Include metadata in the JSON output
options.FormatOutput = true; // Format the JSON output for readability

// Step 3: Set file paths
options.AddInput(new FileDataSource("input.pdf"));
options.AddOutput(new FileDataSource("output.json"));

// Step 4: Run the conversion
converter.Process(options);

文档转换为 JSON 的可用选项

  • IncludeMetadata : 指定是否将文档的metadata纳入 JSON 输出中。
  • FormatOutput :选择是否格式化JSON可读性。

将 JSON 转换为文档

将 JSON 数据转换为文档:

  • 启动转换器 :创建一个例子 JsonConverter.
  • 设置转换选项 :使用 JsonToDocumentOptions 定义目标文档格式和布局。
  • 指定路径 :设置输入 JSON 和输出文档文件路线。
  • 执行转换 :呼叫 Process 创建文档的方法。

例如:将 JSON 转换为 PDF

// Step 1: Initialize the JSON Converter
var converter = new JsonConverter();

// Step 2: Configure options for JSON to Document conversion
var options = new JsonToDocumentOptions(DocumentFormat.Pdf);
options.PageLayoutOption = PageLayoutOption.Portrait;

// Step 3: Set file paths
options.AddInput(new FileDataSource("input.json"));
options.AddOutput(new FileDataSource("output.pdf"));

// Step 4: Execute the conversion
converter.Process(options);

JSON 到文档转换的额外选项

  • DocumentFormat : 指定目标格式(Pdf, Docx等等。
  • PageLayoutOption : 定义结果文档的页面布局(Portrait, Landscape).

这个转换器提供了与网页服务和其他数据导向的应用程序集成文档内容的强大能力. 无论是从文件中提取数据还是从结构化数据中产生文件, Sheetize JSON Converter 是现代文本工作流的理想解决方案。

 中文