← All SmartAdapters Data Extraction

SmartObjectAdapter

Converts unstructured text, images, streams or clipboard content into a typed .NET object.

Attaches to Any .NET type

Point the adapter at a class and hand it raw input — an email, a scanned receipt, a PDF stream — and it returns a populated instance of that class. It reads the shape of your type and fills the properties it can find.

With UseOCR enabled it pulls text out of images, and with tools supplied it will iterate (up to MaxIterations) to complete values it could not resolve on the first pass.

Because the target is an ordinary .NET class, extraction slots straight into code you already have: validation attributes, business rules and persistence all apply to the returned instance like any other object.

What it gives you

  • FromTextAsync, FromImageAsync, FromStreamAsync and FromClipboardAsync.
  • Optional OCR for image-based sources.
  • Iterative resolution of missing values using registered tools.
  • Raises ObjectParsed when an object is produced.

Use it for

  • Invoice and receipt capture, including scans via OCR
  • Turning inbound emails into structured orders
  • Clipboard-to-record imports from any source

Like every adapter, it runs through a SmartHub and inherits its SmartEndpoint — switching the model or provider never changes this code.

csharp
public class Invoice {
    public string Number { get; set; }
    public DateTime Date { get; set; }
    public decimal Total { get; set; }
}

var adapter = new SmartObjectAdapter { UseOCR = true, MaxIterations = 3 };

Invoice invoice = await adapter.FromTextAsync<Invoice>(
    "Invoice #1024 dated 2024-05-01, total 250.00");

Read the SmartObjectAdapter docs ↗