Getting recognition results as JSON

Contents
[ ]

Aspose.OCR for .NET can return recognition results in JSON format - de facto data exchange standard for websites and REST APIs. To get the results as JSON, use GetJson method of Aspose.OCR.RecognitionResult object.

Set isReadable parameter of the method to true to get a JSON string in a human-readable format with line breaks and auto-indentation.

Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
// Add an image to OcrInput object
Aspose.OCR.OcrInput input = new Aspose.OCR.OcrInput(Aspose.OCR.InputType.SingleImage);
input.Add("source.png");
// Recognize image
Aspose.OCR.OcrOutput results = recognitionEngine.Recognize(input);
// Show JSON
string json = results[0].GetJson(true);
Console.WriteLine(json);