This page explains how to use the array_extract function in APL.
array_extract
function to extract specific values from a dynamic array using a JSON path expression. You can use this function to transform structured array data, such as arrays of objects, into simpler arrays of scalars. This is useful when working with nested JSON-like structures where you need to extract only selected fields for analysis, visualization, or filtering.
Use array_extract
when:
Splunk SPL users
spath
with a wildcard or field extraction logic to navigate nested structures. APL’s array_extract
uses JSON path syntax to extract array elements that match a given pattern.ANSI SQL users
JSON_VALUE
or JSON_TABLE
, they operate on single objects. APL’s array_extract
provides a concise and expressive way to query arrays using JSON path.Name | Type | Description |
---|---|---|
sourceArray | dynamic | A JSON-like dynamic array to extract values from. |
jsonPath | string | A JSON path expression to select values from the array. |
array_extract
to retrieve specific fields from structured arrays, such as arrays of request metadata.Query_time | extracted_value |
---|---|
Jun 24, 09:28:10 | [“true”, “false”] |
Jun 24, 09:28:10 | [“true”, “false”] |
Jun 24, 09:28:10 | [“true”, “false”] |
value
field from an array of objects, returning a flat array of booleans in string form.array_extract
, but supports negative indexing.array_extract
.array_extract
.startIndex
for array_extract
.