AI: Query JSON content
The "AI: Query JSON content" service task answers targeted questions about a JSON object and returns the answers as a structured result object. It works identically to the "AI: Query Markdown content" task but accepts JSON data as input.
This makes it possible to analyze complex JSON structures — such as results from previous process steps, API responses or structured datasets — without writing complex JSONata expressions.
Input parameters
Provide the following fields as task input:
{
"content": {
"invoice": {
"number": "INV-2024-001",
"date": "2024-03-15"
},
"customer": {
"name": "Müller GmbH",
"city": "Stuttgart"
},
"items": [
{"article": "Widget A", "quantity": 100, "price": 25.00},
{"article": "Widget B", "quantity": 50, "price": 18.50}
]
},
"questions": [
{
"question": "What is the invoice number?",
"attribute": "invoiceNumber"
},
{
"question": "What is the customer name?",
"attribute": "customerName"
},
{
"question": "What is the total amount across all line items?",
"attribute": "totalAmount",
"format": "Number with 2 decimal places"
}
],
"returnNotFoundFields": false,
"maxContentLength": 50000
}
Explanation:
content: The JSON object to be analyzed. It can be passed as an object or as a pre-serialized JSON string.questions: An array of questions. Each question contains:question: The question in natural language.attribute: The key name in the result object.format(optional): A hint for the AI about the expected answer format.validation(optional): A regular expression (regex) for automatic validation of the extracted value.
returnNotFoundFields(optional, default:false): Iftrue, the result includes a_notFoundarray with attribute names that could not be answered.maxContentLength(optional, default:50000): Maximum character count of the serialized content.
Output
The task returns a JSON object whose keys match the attribute names of the questions:
{
"invoiceNumber": "INV-2024-001",
"customerName": "Müller GmbH",
"totalAmount": 3425.00
}
The AI can also perform calculations (e.g. summing totals) or combine information from nested structures.
JSONata examples
{
"content": api_response.body,
"questions": [
{
"question": "What is the order status?",
"attribute": "orderStatus"
},
{
"question": "When was the order placed?",
"attribute": "orderDate",
"format": "YYYY-MM-DD"
}
]
}
Notes
contentcan be passed as a JSON object or as a JSON string — both are accepted.- For very large JSON structures, the content is serialized internally. The length of the serialized string must not exceed the
maxContentLengthvalue. - The AI analyzes the entire JSON structure including nested objects and arrays.
- All other rules (questions, format, validation, retry logic) are identical to the "AI: Query Markdown content" task.
Tip
This task is especially useful when results from a previous process step (e.g. an HTTP request or another extraction) need to be queried using natural language — without complex JSONata expressions. For Markdown or OCR texts, use the "AI: Query Markdown content" task instead.