Getting recognition results as JSON

Contents
[ ]

Aspose.OCR for JavaScript via C++ can return recognition results in JSON format - de facto data exchange standard for websites and REST APIs. To get recognition results in JSON format, call AsposeOCRSerializeResult() method. Provide the recognition result returned from recognition function and Module.ExportFormat.json (1) value as method parameters.

var input = Module.WasmAsposeOCRInput();
var inputs = new Module.WasmAsposeOCRInputs();
input.url = filename;
inputs.push_back(input);
// Recognize
var settings = Module.WasmAsposeOCRRecognitionSettings();
settings.language_alphabet = Module.Language.DEU;
var result = Module.AsposeOCRRecognize(inputs, settings);
// Get recognition results as JSON
var result_json = Module.AsposeOCRSerializeResult(result, Module.ExportFormat.json);
console.log(result_json);