Table of Contents

Method FromJson

Namespace
LMKit.Extraction.Ocr
Assembly
LM-Kit.NET.dll

FromJson(string)

Deserializes the specified JSON string into an OcrResult instance.

public static OcrResult FromJson(string jsonString)

Parameters

jsonString string

A JSON-formatted string that represents an OcrResult, including its text elements and page layout metadata.

Returns

OcrResult

An OcrResult object populated with data from the JSON string.

Examples

// Restore a previously serialized OCR result
string json = File.ReadAllText("ocr_cache/page1.json");
OcrResult result = OcrResult.FromJson(json);
Console.WriteLine(result.PageText);

Exceptions

JsonException

Thrown if the JSON is invalid or cannot be mapped to an OcrResult.

Share