JSON Converter
The Sheetize JSON Converter for .NET offers robust functionality for converting documents to and from JSON format, enabling easy integration into web applications and data processing workflows.
Key Features
Document to JSON Conversion
Convert documents (e.g., PDF, DOCX) to JSON format to extract content in a structured format for further analysis or integration.
JSON to Document Conversion
Transform JSON data into document formats such as PDF or DOCX, allowing for easy report generation or document automation.
Detailed Guide
Converting Document to JSON
To convert a document to JSON:
- Initialize the Converter: Create an instance of
JsonConverter
. - Set Conversion Options: Use
DocumentToJsonOptions
to configure how the document is represented in JSON. - Define Input and Output Paths: Set paths for the input document and output JSON file.
- Execute the Conversion: Call the
Process
method to convert the document.
Example: Convert PDF to 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);
Available Options for Document to JSON Conversion
- IncludeMetadata: Specify whether to include document metadata in the JSON output.
- FormatOutput: Choose whether to format the JSON for readability.
Converting JSON to Document
To convert JSON data to a document:
- Initialize the Converter: Create an instance of
JsonConverter
. - Set Conversion Options: Use
JsonToDocumentOptions
to define the target document format and layout. - Specify Paths: Set input JSON and output document file paths.
- Execute the Conversion: Call the
Process
method to generate the document.
Example: Convert JSON to 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);
Additional Options for JSON to Document Conversion
- DocumentFormat: Specify the target format (
Pdf
,Docx
, etc.). - PageLayoutOption: Define the page layout for the resulting document (
Portrait
,Landscape
).
This converter provides powerful capabilities for integrating document content with web services and other data-driven applications. Whether extracting data from documents or generating documents from structured data, the Sheetize JSON Converter is an ideal solution for modern document workflows.