Application icon

Extract Data from Container

This function is used to extract the value of the item specified in the direct path field. The result is written to a specified named variable. The directed path field can refer to a container or any item in a container. If the targeted item does not exist, it is considered an error.

All text fields can contain any of the escape sequences defined in Escape Sequences.

The action test state will be set to true if there are no errors. The action test state will be false if any errors occurred. Named variable Container Error will contain the errror text. If the Stop action on error option is enabled, the action will be terminated with an error message in the case of an error. Remember that the non existence of the targeted item is considered an error. For that reason you will typically not set the Stop action on error option.

Note that optionally every item which is returned can be prefixed by a single character tag identifying the type. This is useful when you want to determine the data type of an available item. If the Include the data tag option is set, the prefix character is included.

This statement can effectively be performed in an escape sequence where the include data tag option is disabled and errors are not reported. The sequence which can be found on the Insert Yate Escape Sequence > Numeric Exprs/Container Refs menu is as follows:

\?[ directed path \?]

The following list describes how each queried JSON data item is returned. In the examples it is assumed that the include data tag option is set. The data tag character is indicated in blue. All examples refer to the following JSON text in a container named sample.

    "id" : 23,
    "location" : {
      "address" : "123 Front Street",
      "phone #" : "555-5555",
      "city" : "Toronto",
    "moods" : [
    "name" : "Jack",
    "special" : true,
    "id" : "item 0"
    "description" : "great person",
    "id" : 24,
    "location" : {
      "address" : "21 Main Street",
      "phone #" : "555-2222",
      "city" : "Toronto"
    "moods" : [
    "name" : "Jill",
    "special" : null,
    "id" : "item 1"

Returned data formats:


Example: directed path: sample[1].location.address
returned value: @21 Main Street


Example: directed path: sample[1].id
returned value: #24

!true or false

Example: directed path: sample[0].special
returned value: !true


Example: directed path: sample[0].special
returned value: ~

Note that the word null is not returned.


The Default List Delimiter (\~) separates the names found in the object.

Example: directed path: sample[1].location
returned value: {address\~phone #

Names will be enclosed in double quote (") sequences if required.

[number of items in the array

Example: directed path: sample[0].moods
returned value: [3


This data type can only be found in containers created by reading a plist file using the Read/Write Plist File. The format of the date string is dependent on the OS.


This data type can only be found in containers created by reading a plist file using the Read/Write Plist File. The format of the data string is a summary of the data generated by the OS.

Validating Data Types

You can optionally specify that the returned test state should be false unless a particular data type is referenced by the specified directed path field. The Data type control is used to choose a must match data type. When not set to Any, a test will be made against the specified data type. If the data type of the returned data does not satisfy the referenced item, the action test state will be set to false.

The data types of Array, Object, String, Boolean and Null match specific data types. A data type of Node implies that any of String, Number, Boolean, Null or the plist data types of Date or Data will be accepted. A data type of Number will match Number and Boolean.

When a Boolean is matched by a data type of Number the returned value will be 1 or 0 as opposed to true or false.

When the specified data type is Any, Node or String you have additional options which modify the returned value. This only occurs at runtime if the extracted value was from actually from a String. The following options are available:

Normalize newline sequences
JSON text can contain carriage return characters. This option will effectively do the normalize newline sequences function as is available in the Trim statement.

Fold Characters
JSON text can contain almost any Unicode characters. This option folds characters as performed by the Re-Encode statement's Fold Characters function.

Matching Array Elements

There are a few special forms of a directed path which can be used to extract all values of array items, the directed paths of array items, and to set named variables to the directed paths of array items.

Enumerate Unique Array Elements

The form [*] implies that a referenced array is to be enumerated. At most one [*] form may be specified. The List Secondary Delimiter (\:) separates the returned array elements. Note that if the array does not contain any elements, the destination named variable will be empty. Empty elements are not returned and duplicates may be.

Example: directed path: sample[1].moods[*]
returned value: @classical●@opera●@jazz

Example: directed path sample[*].location.address
returned value: @123 Front Street●@21 Main Street

The [*] form is also unique that in certain circumstances it will not fail on an Object name which does not exist. A non existent .name sequence will not be considered an error if the required data type is anything other than Array or Object. The value returned is an empty string and if data types are being included a special data type of ? will be used. Note that empty elements are not returned unless the data type tag is requested.

Example: directed path: sample[*].description (with data tag)
returned value: ?@great person

Example: directed path sample[*].description (without data tag)
returned value: ●great person

Directed Path to an array element

While you can use hard coded array indexes to refer to an array element, this can be detrimental if the array structure can change.

You can use the [*] form to return the directed paths of the array elements where the returned value (included the optional data tag) would match a supplied pattern. The equality test is always case insensitive. The key-value delimiter (\k) is used to separate the directed path from the pattern. Note that spaces are significant after the \k delimiter. Only items which match the pattern will have their path's returned. The List Secondary Delimiter (\:) separates the returned array elements.

Example: directed path: sample[*]≔Toronto (without data tag)
returned value: sample[0]●sample[1]

Example: directed path sample[*].name\kJill (without data tag)
returned value: sample[1]

Directed Paths to Named Variables

You can also extract the directed paths of array elements to named variables. The value of the referenced item (typically an object name) is interpreted as being the named variable. The returned value is a list of the named variables which were modified, delimited by the default list delimiter (\~). A double key-value delimiter is used to represent the mode. Any text after the \k\k sequence is ignored.

Example: Save all id element values to named variables.

Extract data from the container item at 'obj[*].id\k\k' to named variable 'res'

will set the following named variables:

item 0:  obj[0]
item 1:  obj[1]
res:     item·1⏎item·0


Directed Paths