GetLiveTextAsJSON

Returns the text and position as JSON data for each line of text found in an image in a container field by using the text-recognition algorithm.

Format 

GetLiveTextAsJSON ( container ; language )

Parameters 

container - any expression that returns container data.

language - the language code of the text-recognition algorithm to use (see GetLiveText).

Data type returned 

text

Originated in version 

21.0

Description 

This function is similar to the GetLiveText function, except that it returns an array of JSON objects, one for each text segment in the image. Each object contains the text and its position in this format:

Copy
[
    {
        "x": 10,
        "y": 20,
        "text": "Segment of text"
    },
    ...
]

The values for x and y are in pixels from the top left corner of the image.

For details on supported language codes and operating system versions, see GetLiveText.

Example 1 

In the InvoiceText field, stores the text extracted from the image in the InvoiceContainer field using the en-US text-recognition algorithm.

Copy
Set Field [Invoices::InvoiceText ; GetLiveText ( Invoices::InvoiceContainer ; "en-US" )]

Sets the InvoiceText field to:

Copy
[
    {
        "x": 113,
        "y": 230,
        "text": "Erickson's Water Garden"
    },
    {
        "x": 288,
        "y": 230,
        "text": "Alea Marks"
    },
    {
        "x": 421,
        "y": 230,
        "text": "2053 Lorem Rd."
    },
    {
        "x": 493,
        "y": 230,
        "text": "12/22/2019"
    }
]