Convert DOCX to JSON Format via C++

Export DOCX to JSON via C++ without using Microsoft® Word or Excel

DOCX Conversion via C# .NET DOCX Conversion via Java DOCX Conversion in Android Apps

 

Why to Convert

Converting documents from one format to another is a common requirement in many applications. For example, converting a DOCX file to JSON format can be useful for applications that need to store and manipulate data in a structured format. JSON is a popular data interchange format that is used to store and exchange data between different applications.

How Aspose.Total Helps for DOCX to JSON Conversion

Aspose.Total for C++ is a comprehensive suite of components that enables developers to create, manipulate and convert various document formats within their C++ applications. It includes Aspose.Words for C++, which can be used to export DOCX files to HTML. Aspose.Cells for C++ can then be used to convert the HTML to JSON format. This makes it easy to convert DOCX to JSON within C++ applications.

Convert DOCX to JSON Format via C++

  1. Open DOCX file using Document class reference
  2. Convert DOCX to HTML by using Save member function
  3. Load HTML document by using IWorkbook class reference
  4. Save the document to JSON format using Save member function

Get Started with C++ File Automation APIs

Install via Package Manager Console of Visual Studio with Install-Package Aspose.Total.Cpp.

Alternatively, get the offline MSI installer or DLLs in a ZIP file from downloads .

// supports DOC, DOT, DOCX, DOCM, DOTX, DOTM, RTF, WordML, MOBI, ODT, and OTT file formats
// load DOCX as input file format with an instance of Document class
auto doc = MakeObject<Document>(u"Input.docx");
// save document in HTML format
doc->Save(u"Output.html");
// Load the HTML.
intrusive_ptr<Aspose::Cells::IWorkbook> wkb = Factory::CreateIWorkbook(u"Output.html");
// Save in JSON format.
wkb->Save(u"Output.json", SaveFormat_Json);

Convert Protected DOCX to JSON Format via C++

Using the API, you can also open the password-protected document. If your input DOCX document is password protected, you cannot convert it to JSON format without using the password. To do this, use a special constructor overload, which accepts a LoadOptions object. This object contains the Password property, which specifies the password string.

// supports DOC, DOT, DOCX, DOCM, DOTX, DOTM, RTF, WordML, MOBI, ODT, and OTT file formats
// Loads encrypted document.
System::SharedPtr<Document> doc = System::MakeObject<Document>(u"LoadEncrypted.docx", System::MakeObject<LoadOptions>(u"aspose"));
// save document in HTML format
doc->Save(u"Output.html");
// Load the HTML.
intrusive_ptr<Aspose::Cells::IWorkbook> wkb = Factory::CreateIWorkbook(u"Output.html");
// Save in JSON format.
wkb->Save(u"Output.json", SaveFormat_Json);

Explore DOCX Conversion Options with C++

Convert DOCX to CSV (Comma Seperated Values)
Convert DOCX to DIF (Data Interchange Format)
Convert DOCX to EXCEL (Spreadsheet File Formats)
Convert DOCX to FODS (OpenDocument Flat XML Spreadsheet)
Convert DOCX to ODP (OpenDocument Presentation Format)
Convert DOCX to ODS (OpenDocument Spreadsheet)
Convert DOCX to POT (Microsoft PowerPoint Template Files)
Convert DOCX to POTM (Microsoft PowerPoint Template File)
Convert DOCX to POTX (Microsoft PowerPoint Template Presentation)
Convert DOCX to PPTX (Open XML presentation Format)
Convert DOCX to PPS (PowerPoint Slide Show)
Convert DOCX to PPSM (Macro-enabled Slide Show)
Convert DOCX to PPSX (PowerPoint Slide Show)
Convert DOCX to PPT (PowerPoint Presentation)
Convert DOCX to PPTM (Macro-enabled Presentation File)
Convert DOCX to PPTX (Open XML presentation Format)
Convert DOCX to SXC (StarOffice Calc Spreadsheet)
Convert DOCX to TSV (Tab-separated Values)
Convert DOCX to XLAM (Excel Macro-Enabled Add-In)
Convert DOCX to XLS (Microsoft Excel Binary Format)
Convert DOCX to XLSB (Excel Binary Workbook)
Convert DOCX to XLSM (Macro-enabled Spreadsheet)
Convert DOCX to XLSX (Open XML Workbook)
Convert DOCX to XLT (Excel 97 - 2003 Template)
Convert DOCX to XLTM (Excel Macro-Enabled Template)
Convert DOCX to XLTX (Excel Template)
Convert DOCX to ODP (OpenDocument Presentation Format)
Convert DOCX to POT (Microsoft PowerPoint Template Files)
Convert DOCX to POTM (Microsoft PowerPoint Template File)
Convert DOCX to POTX (Microsoft PowerPoint Template Presentation)
Convert DOCX to PPTX (Open XML presentation Format)
Convert DOCX to PPS (PowerPoint Slide Show)
Convert DOCX to PPSM (Macro-enabled Slide Show)
Convert DOCX to PPSX (PowerPoint Slide Show)
Convert DOCX to PPT (PowerPoint Presentation)
Convert DOCX to PPTM (Macro-enabled Presentation File)
Convert DOCX to PPTX (Open XML presentation Format)