json to html

How to convert a JSON file to HTML format online.

JSON (JavaScript Object Notation) is the go-to format for structured data interchange in modern applications. However, when it comes to presenting this data visually on the web, converting it into HTML—particularly into styled, tabular layouts—is essential. With Aspose.Cells Cloud SDK for Node.js, you can convert raw JSON files into readable, responsive HTML files, ideal for dashboards, reports, and browser-based rendering.

Node.js API for JSON to HTML Conversion

The Aspose.Cells Cloud SDK for Node.js allows seamless JSON to HTML transformation. It utilizes the cloud’s scalability to render lightweight, clean HTML files directly from your JSON data—no need for Excel or third-party libraries.

Key Features

  • Convert JSON files to well-formatted HTML documents.
  • Supports table rendering with headers, cells, and embedded styles.
  • Cloud-hosted—no local software required.
  • RESTful and secure with OAuth 2.0.

Getting Started

  1. Install SDK via npm:
npm install asposecellscloud --save
  1. Obtain Client Credentials: Create an account at Aspose.Cloud Dashboard and obtain your Client ID and Client Secret. For further details, you may consider visiting quick start article.

Convert JSON to HTML Using Node.js

Follow these steps to perform the conversion using Node.js:

Step 1: Initialize the API:

const { CellsApi, PostWorkbookSaveAsRequest } = require("asposecellscloud");
const cellsApi = new CellsApi("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");

Step 2: Upload JSON File:

const fs = require("fs");
const path = require("path");

const jsonFilePath = path.resolve("data.json");
await cellsApi.uploadFile("data.json", fs.createReadStream(jsonFilePath));

Step 3: Send Conversion Request:

const saveOptions = {
  SaveFormat: "HTML"
};

const request = new PostWorkbookSaveAsRequest({
  name: "data.json",
  newfilename: "converted/output.html",
  saveOptions: saveOptions,
  isAutoFitRows: true,
  isAutoFitColumns: true
});

await cellsApi.postWorkbookSaveAs(request);
console.log("JSON successfully converted to HTML.");
json to html

A preview of JSON to HTML file conversion.

  • The sample JSON file used in the above example cam be downloaded from input.json.

Save JSON to HTML Using cURL

If you prefer command-line tools or script-based automation, use the following cURL method.

Step 1 – Generate Access Token:

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Step 2 – Send JSON to HTML Conversion Request:

curl -X 'POST' \
  'https://api.aspose.cloud/v3.0/cells/{sourceJSON}/SaveAs?newfilename={resultantHTML}&isAutoFitRows=false&isAutoFitColumns=false&checkExcelRestriction=false' \
  -H "accept: application/json" \
  -H "authorization: Bearer <ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -d "{
    \"SaveFormat\": \"html\",
    \"ClearData\": true,
    \"CreateDirectory\": true,
    \"EnableHTTPCompression\": true,
    \"RefreshChartCache\": true,
    \"SortNames\": true,
    \"ValidateMergedAreas\": true,
    \"MergeAreas\": true,
    \"SortExternalNames\": true,
    \"CheckExcelRestriction\": true,
    \"UpdateSmartArt\": true,
    \"EncryptDocumentProperties\": true
}"

Replace sourceJSON with the name of input JSON file, resultantHTML with the name of resultant HTML file and ACCESS_TOKEN with JWT access token generated above.

Try Free Online JSON to HTML Converter

Want to try before coding? Use our Online JSON to HTML Converter to quickly visualize structured data as a web page.

json to html converter

Free online JSON to HTML converter App.

📚 Additional Resources

Conclusion

With Aspose.Cells Cloud SDK for Node.js, converting JSON files to clean, structured HTML becomes effortless. Whether you’re rendering API responses, creating data visualizations, or displaying analytics reports, this cloud-based solution offers unmatched reliability and ease of use.

Get started today to streamline your JSON to HTML workflows using the power of Node.js and RESTful APIs.

We highly recommend visiting the following blogs: