Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Converts a string to a JSON object.
This procedure converts a string to a JSON object by parsing the string content. The string should contain valid JSON syntax. The procedure automatically handles strings that may have extra text before or after the JSON content by identifying and extracting the JSON portion (looking for opening { or [ and corresponding closing } or ]).
This example converts a string containing JSON to a JSON object.
This example converts a string representation of a JSON object to an actual JSON object.
This example shows converting a JSON string and then accessing its fields. The result would be "0.5% 10 NET 45" for Description and "38" for TermsCode.
This example demonstrates converting a string containing a JSON array to an actual JSON array with multiple product objects.
This example shows converting a complex nested JSON structure from a string and then accessing a field. For a JSON with nested objects like {"u_project_name": {"link": "...", "value": "..."}, "state": "4"}, this would return "4".
Automation procedures for converting files to PDF.
To convert from Word (.doc or .docx) to portable document format (.pdf):
the file is the document
read the file as a pdfTo convert a picture (.jpg / .png) to portable document format (.pdf):
.tif and .tiff FilesTo work with .tif or .tiff files in Kognitos, you can convert them to PDF format and use PDF operations on them. To convert to PDF, use the following syntax:
Automation procedures for removing duplicates from a PDF file.
To remove duplicates from a PDF with a specified confidence threshold, use the following syntax:
get the pdf
the department's duplicate confidence threshold is 0.95
remove duplicates from the pdfTo remove duplicates from a PDF without specifying a confidence threshold, use the following syntax:
Automation procedures for saving a PDF file after making changes.
string
string
The string to be converted into a JSON object
Yes
N/A
json
The JSON object obtained from the string conversion
convert a file to a pdf file with
the file is the pictureread a file as a pdfget the pdf
remove duplicates from the pdfget the pdf
save the pdf to a file with
the target is "s3://bucket-name/path/to/save/the/pdf"get the string
get the string as jsonthe string is '{"name":"John", "age":30, "city":"New York"}'
get the string as jsonthe term is "{\"TermsCode\": \"38\", \"Description\": \"0.5% 10 NET 45\"}"
get the term as a json
get the json's Description
get the json's TermsCodethe term is "[{\"Product Name\": \"P854282R COMP\", \"Quantity\": \"3\", \"Price\": \"$53.00\", \"Prices\": [\"1\", \"2\"]},{\"Product Name\": \"F854734 COMPR\", \"Quantity\": \"1\", \"Price\": \"$34.95\", \"Prices\": [\"2\", \"3\"]}]"
get the term as a jsonget the val as a json
get the json's stateOpens a JSON file from either an S3 URL or an uploaded file.
This procedure opens and reads a JSON file from either a specified S3 URL or uploaded directly to Kognitos. It retrieves the file content, parses it as JSON, and returns the JSON object.
This example opens a JSON file stored at the specified S3 URL and returns the parsed JSON object.
This example opens a JSON file that was uploaded by the user to Kognitos.
This example reads a JSON file stored at the specified S3 URL and returns the parsed JSON object. This is an alternative syntax to "open a json at a file" and provides the same functionality.
This example demonstrates reading a JSON file containing student and course information from a test resource. The result would be a JSON object with nested structures for student details and course arrays.
This example shows the error handling when attempting to read an invalid or non-existent JSON file. The system will prompt with "Could not read a json from a file."
Converts a JSON object to a string representation.
file
string
The S3 URL of the JSON file to be opened
Yes
N/A
json
The JSON object obtained from the file
This automation procedure combines multiple PDFs into a single PDF file.
get the attachments
get the above as the scanned documents
merge the scanned documents into a single document where
the document name is "statements.pdf"json
json
The JSON object to be converted
Yes
N/A
string
The string representation of the JSON object
This example converts a JSON object to its string representation.
This example demonstrates converting a JSON object with special characters (quotes and percentages) to a string. The result would be: {"TermsCode": "38", "Description": "0.5% 10 NET 45"}
This example shows converting an empty JSON object to its string representation "{}".
This example demonstrates working with a nested JSON structure with multiple levels that can be converted to a string.
the file is "s3://my-bucket/data/json.json"
open a json at the stringthe file
open the json at the filethe file is "s3://my-bucket/data/json.json"
read the json from the filethe file is "s3://bucket-name/resources/example.json"
read the json from the filethe invalid file is "some-file"
read the json from the invalid fileget the json
get the json as a stringthe term is "{\"TermsCode\": \"38\", \"Description\": \"0.5% 10 NET 45\"}"
get the term as a json
get the term as a stringcreate an empty json
use the above as the best json
the best json
get the best json as a stringthe AddressInformation is '{"BillingAddress": {"Name": "Brown Integrated Logistics"}}'
get the AddressInformation as a jsonSets or changes a specific value within a JSON object to a new value.
This procedure sets or changes a specific value within a JSON object to a new value. The verbs "set" and "change" are interchangeable. It supports both simple field names and nested paths using dot notation (e.g., settings.notifications.enabled). If the field does not exist, it will be created. The JSON object is modified in place.
This procedure modifies the JSON in place and does not return a value.
This example sets the "age" field of the JSON object to 23.
This example sets the "name" field of the JSON object to "John Doe".
This example sets a deeply nested field using dot notation.
This example shows multiple sequential modifications to JSON fields. The TermsCode is changed from "38" to 39.
This example uses the explicit "set" command to modify a field.
This example uses the "change" command, which is equivalent to "set".
This example adds a new field "Label" to an existing JSON object. The result would be: {"TermsCode": 42, "Description": "0.5% 10 NET 45", "Label": "Default"}
This example demonstrates setting one JSON object as a field within another JSON object.
This example shows setting a list as a field value in a JSON object.
This example demonstrates setting array elements using ordinals like "first", "second", and "last".
This example shows setting fields within objects that are elements of an array.
Compares two JSON objects and identifies differences between them.
any
The new value to be set at the specified path within the JSON object
Yes
N/A
json
json
The JSON object to be modified
Yes
N/A
thing
string
The path within the JSON object where the value is to be set or changed (specified as a handle)
Yes
N/A
target
target
json
The first JSON object to be compared
Yes
N/A
object
json
The second JSON object to be compared
Yes
N/A
differences
A list of keys where the values differ between the two JSON objects. Each difference is represented as a string indicating the key that differs
This example compares two JSON objects and identifies that the "age" field differs.
This example compares two JSON objects with nested structures. Note that the comparison identifies "specs" as different (since the nested object differs), not the individual nested fields.
This example demonstrates a complete workflow: loading two JSON objects (where the actual json might be {"name": "john", "age": 28} and expected json is {"name": "john", "age": 29}), comparing them, and storing the list of differences (["age"]) in a fact for later use.
To set a field in a PDF to a numeric value, use the following syntax:
To change a field in a PDF to a numeric value, use the following syntax:
get the pdf
the field is "Date"
set the pdf's field to "2023-01-01"get the pdf
the field is "Name"
change the pdf's field to "John Doe"This procedure has no input concepts.
json
An empty JSON object {}
This example creates an empty JSON object {}.
This example creates an empty JSON object and assigns it to a fact called "request".
This example creates an empty JSON and then populates it with three fields: name, age, and company.
This example creates another empty JSON object with a different fact name and populates it with company and address fields.
This example creates multiple JSON objects and nests one within another. The result would be: {"data": {"age": "23"}}
This example creates an empty JSON object that will be used to merge or combine data from other sources.
get the json
the json's age is 23get the json
set the json's name to "John Doe"get the json
change the json's "settings.notifications.enabled" to falsethe term is "{\"TermsCode\": \"38\", \"Description\": \"0.5% 10 NET 45\"}"
get the term as a json
the term is a json
get the term's TermsCode
get the term's Description
the term's TermsCode is 39
get the term's TermsCode
the termset the term's TermsCode to 41
get the term's TermsCodechange the term's TermsCode to 42
get the term's TermsCodethe term's Label is "Default"
the termthe internaljson is "{}"
the internaljson is a json
set the internaljson's age to "23"
the finaljson is "{}"
the finaljson is a json
set the finaljson's data to the internaljsonimagine valid items
the number is 1
add the number to the valid items
set the finaljson's name to the itemsset the foo's first apple to 10
set the foo's second apple to 20
set the foo's last apple to 40set the foo's second objects.b to 22
set the foo's last objects.c to 33set the target to
{
"name": "John",
"age": 30,
"city": "New York"
}
set the object to
{
"name": "John",
"age": 31,
"city": "New York"
}
compare the target json with the object jsonset the target to
{
"product": "Laptop",
"price": 1200,
"specs": {
"RAM": "16GB",
"Storage": "512GB SSD"
}
}
set the object to
{
"product": "Laptop",
"price": 1200,
"specs": {
"RAM": "8GB",
"Storage": "256GB SSD"
}
}
compare the target json with the object jsonget the actual json
get the actual json as a json
the actual json is a json
get the expected json
get the expected json as a json
the expected json is a json
compare the expected json with the actual json
use the above as the keys
the keysget the pdf
the field name is "Total Amount"
set the pdf's field to 150get the pdf
the field name is "Page Count"
change the pdf's field to 5create a jsoncreate a json
use the above as the request
the requestcreate a empty json
use the above as json1
set the json1's name to "kalpesh"
set the json1's age to 28
set the json1's company to "Kognitos"create an empty json
use the above as json2
set the json2's company to "XYZ"
set the json2's address to "Bangalore"the internaljson is "{}"
the internaljson is a json
set the internaljson's age to "23"
the finaljson is "{}"
get the finaljson as a json
the finaljson is a json
set the finaljson's data to the internaljsoncreate an empty json
use the above as the main json
set the main json's "attachment" to the attachment jsonGenerates a PDF document for each row in an Excel file by merging data into a .docx template.
This procedure fills placeholders in a Word document (.docx) template with data from an Excel (.xlsx) file. One output document is generated per row in the spreadsheet. Placeholders in the template are marked by a pair of characters (default is "{}") and must match the column headers in the Excel file.
Below is a line-by-line overview of the automation syntax. Expand each line to learn more.
unlock the file
the password is "abcd1234"
the file is the aboveunlock the file
the password is "secret-password"
the file is the abovethe password is "abcd1234"the template is "path/to/template.docx"
the data file is "path/to/data.xlsx"
the template marker is "<>"
create pdfs from the template where
the excel is the data fileDeletes a specified key from a JSON object.
This procedure deletes a specified key from a JSON object. The field is permanently removed from the JSON structure. If the specified key does not exist in the JSON, the operation completes successfully without error (in the new JSON implementation). The procedure supports both simple field names and nested paths using dot notation.
This example deletes the "username" field from the JSON object.
This example deletes the "TermsCode" field and shows the resulting JSON object would be: {"Description": "0.5% 10 NET 45"}
This example demonstrates that deleting a non-existent field does not cause an error and leaves the JSON unchanged at {"Description": "0.5% 10 NET 45"}.
This example shows deleting a nested field using dot notation. For a JSON like {"b": {"c": 1, "d": {"e": [1, 2]}}}, this would remove the entire "d" object.
This example demonstrates deleting fields from specific elements in an array using ordinals. For a JSON with an "objects" array, this removes the "b" field from the second object and the "c" field from the last object.
This example shows deleting fields from nested array structures. The second command demonstrates that deleting a non-existent field ("nowhere") does not cause an error.
json
json
The JSON object from which the key will be deleted
Yes
N/A
thing
string
The key to be deleted from the JSON object
Yes
N/A
json
The updated JSON object after the specified key has been deleted
get the json
delete the json's usernamethe term is "{\"TermsCode\": \"38\", \"Description\": \"0.5% 10 NET 45\"}"
get the term as a json
the term is a json
delete the term's TermsCode
the termdelete the term's mybadfield
the termdelete the foo's b.ddelete the foo's second objects.b
delete the foo's last objects.cdelete the foo's third val.noteverywhere
delete the foo's first val.nowhereFills in a template with provided placeholder values.
This procedure fills in a template with provided values. Currently, only .txt and .docx file types are supported for use as template files. This procedure is helpful in automation workflows where documents need to be dynamically generated, such as invoices, contracts, letters, certificates, or reports.
Consider the following .txt file, containing placeholders enclosed in < > symbols:
Note: Line 1 will raise a question, prompting you to provide or upload the template file itself.
Purchase Confirmations
Generate confirmation emails or documents for online purchases
{order_id}, {product_name}, {price}
Service Agreements
Populate service agreements with client and project info
{client_name}, {service_description}
The characters used to mark the placeholders in the template. Must be exactly two characters.
Text
"{}"
No
Customer Invoices
Automatically create invoices from billing data
{date}, {customer_name}, {total_amount}
Employment Contracts
Generate contracts for new hires based on HR forms
{employee_name}, {start_date}, {role}
Appointment Reminders
Send personalized reminders to patients or clients
{patient_name}, {appointment_time}
Event Certificates
Create custom certificates for attendees
template
The .txt or .docx file to be filled in.
File
N/A
Yes
placeholder values
The text that will fill in the placeholders in the template. These must be enclosed in quotes. For example:
the name is "Jane Doe"
Text / String
N/A
Yes
file
The file with the specified placeholders replaced by the provided values.
{participant_name}, {event_name}
template marker
Invoice
Date: <date>
Customer Name: <customer_name>
Item: <item_description>
Total Amount: <total_amount>
Thank you for your business!the template
fill in the template
the template marker is "<>"
the date is "4/23/2025"
the customer_name is "Jane Doe"
the item_description is "Web Design Services"
the total_amount is "$2000"Invoice
Date: 4/23/2025
Customer Name: Jane Doe
Item: Web Design Services
Total Amount: $2000
Thank you for your business!Merges two JSON objects and returns the merged result.
target
json
The first JSON object
Yes
N/A
object
json
The second JSON object which will be merged with the first
Yes
N/A
json
The final merged JSON object
This example merges two JSON objects where some keys overlap. The merged result would be: {"address": "Bangalore", "age": 28, "company": "Kognitos", "name": "john"}. Note that in the basic implementation, the "company" field from json2 would overwrite json1's value.
This example verifies that the original JSON objects are not modified by the merge operation.
For nested JSON structures like:
json1: {"company": "XYZ", "address": {"street": "State", "pets": ["Garfield", "Opus"]}}
json2: {"age": 28, "name": "john", "company": "Kognitos", "address": {"number": 123, "street": "Main", "pets": ["Alf"]}}
The new JSON implementation's recursive merge produces: {"age": 28, "name": "john", "company": "XYZ", "address": {"number": 123, "street": "State", "pets": ["Alf", "Garfield", "Opus"]}}
This demonstrates:
Nested objects are merged recursively
Arrays are concatenated (not replaced)
Primitive values from json1 overwrite those in json2
This example shows a complete workflow of creating two JSON objects and merging them. The final result would be: {"name": "John", "age": 30, "height": 182, "city": "Bangalore"}
In case of duplicate keys, the value from the second JSON (object) overwrites the value from the first JSON (target).
For example:
target json: {"name": "John", "age": 30}
object json: {"place": "USA", "age": 31}
final result: {"name": "John", "place": "USA", "age": 31}
The "age" field is updated to 31 from the object json.
create a empty json
use the above as json1
set the json1's name to "john"
set the json1's age to 28
set the json1's company to "Kognitos"
create an empty json
use the above as json2
set the json2's company to "XYZ"
set the json2's address to "Bangalore"
merge the json1 with the json2the json1
the json2merge the json1 with the json2create an empty json
use the above as the targetjson
set the targetjson's name to "John"
set the targetjson's age to "30"
create an empty json
use the above as the objectjson
set the objectjson's height to 182
set the objectjson's city to "Bangalore"
merge the target json with the object jsonExtracts a specific element or elements from a JSON structure.
This procedure extracts a specific element or elements from a JSON structure based on the specified "thing" (field name or path). The thing can be specified with additional adjectives to refine the search within the JSON structure. It supports both simple field access and nested path traversal using dot notation (e.g., address.city) or possessive syntax (e.g., address's city). When the JSON is an array, it can extract values from multiple objects.
This example extracts the "name" field from a JSON object.
This example extracts the "first name" field from a JSON object. If the JSON is an array, it returns the "name" field from the first element.
This example extracts the "city" field from the nested "address" object using dot notation.
This example extracts the "city" field from the nested "address" object using possessive syntax.
This example extracts a field named "address city" (a single key with a space in it).
This example shows how to extract fields from an array of JSON objects. When the JSON is an array like [{"Product Name": "P854282R COMP", "Price": "$53.00"}, {"Product Name": "F854734 COMP", "Price": "$34.95"}], you can use ordinals like "first" and "second" to access specific elements.
This example demonstrates accessing deeply nested fields using multiple possessive syntax. For a JSON structure with customers, orders, and order details, this navigates through multiple levels to extract the id field.
This example shows accessing fields with camelCase naming conventions like "threadId", "historyId", and "sizeEstimate".
json
json
The JSON structure from which the thing is to be extracted
Yes
N/A
thing
string
The specific element or elements to extract from the JSON (can include adjectives to refine the search)
Yes
N/A
result
The extracted element or elements from the JSON structure. If multiple elements are extracted, they are returned as a list
get the json
get the json's nameget the json
get the json's first nameget the json
get the json's address.cityget the json
get the json's address's cityget the json
get the json's address cityget the term as a json
get the json's Prices
get the json's first Price
get the json's first Product Name
get the json's second Quantityget the foo's first order's first detail's idget the email's threadId
get the email's historyId
get the email's sizeEstimateBasic procedures for extracting information from a PDF.
There are several ways to get or extract data from a PDF in Kognitos. The procedures listed below are the most basic methods. For a more advanced method, refer to the procedure.
This procedure allows you to retrieve a specific label from a PDF.
This procedure allows you to retrieve a specific field from a PDF.
get the pdf
get the pdf's label where
the label is "Invoice Number"get the pdf
get the pdf's field where
the field contains "Date"