Skip to content

Instantly share code, notes, and snippets.

@groupdocs-cloud-gists
Last active April 2, 2025 09:45
Show Gist options
  • Save groupdocs-cloud-gists/c2aa5808acd434de26855ea63b45860e to your computer and use it in GitHub Desktop.
Save groupdocs-cloud-gists/c2aa5808acd434de26855ea63b45860e to your computer and use it in GitHub Desktop.
JSON to HTML Conversion in Java
How to develop JSON to HTML using Java REST API.
// More examples over https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet
// Obtain your API credentials
string clientId = "XXXXXX-XXXXXXXXX-4088-9ca0-55c38f4b7f22";
string clientSecret1 = "XXXXXXXXXXXXXXXXXXXX";
// Create an instance of the Configuration class and initialize it with the Client ID & Client Secret
Configuration configuration = new Configuration(clientId, clientSecret);
// Define the API base URL for JSON file to HTML webpage conversion operation
configuration.setApiBaseUrl("https://api.groupdocs.cloud");
// Initialize an instance of ConvertApi with the Configuration object
ConvertApi convertApi = new ConvertApi(configuration);
ConvertSettings settings = new ConvertSettings();
settings.setStorageName("internal");
settings.setFilePath("source.json");
settings.setFormat("html");
settings.setOutputPath("myResultant.html");
// Invoke the ConvertDocument API for JSON file to HTML conversion
ConvertDocumentRequest request = new ConvertDocumentRequest(settings);
List<StoredConvertedResult> response = convertApi.convertDocument(request);
// Check the response and print success message
if (response != null && response.equals("OK")) {
System.out.println("Conversion successful! HTML saved at: " + response.getFilePath());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment