Getting recognition results as JSON

Contents
[ ]

Aspose.OCR for 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 asposeocr_serialize_result() function. You must provide the recognition result returned from recognition function in recognition_result parameter and export_format::json value in format parameter.

// Provide images
string file = "page1.png";
AsposeOCRInput source1;
source1.url = file.c_str();
string file = "page2.png";
AsposeOCRInput source2;
source2.url = file.c_str();
std::vector<AsposeOCRInput> content = { source1, source2 };
// Fine-tune recognition
RecognitionSettings settings;
settings.language_alphabet = language::ukr;
// Extract text from the image
auto result = asposeocr_recognize(content.data(), content.size(), settings);
// Output the recognized text
wchar_t* buffer = asposeocr_serialize_result(result, buffer_size, export_format::json);
std::wcout << std::wstring(buffer) << std::endl;
// Release the resources
asposeocr_free_result(result);