Escribal
Back to Docs

JSON

Transformation

This group reshapes the data inside a loaded JSON document — converting a field’s type, tidying text, doing arithmetic, joining fields, and working on lists (filter, sort, group, aggregate, flatten, and transform every element). Each instruction writes its result back into the document, so there is normally nothing extra to save.

Prerequisite: a JSON document must already be loaded — created with Create JSON file or opened with one of the Opening instructions (for example Open JSON File).

These concepts recur across the instructions in this group; they are explained here once.

  • This group changes the document. Each instruction writes its result into the document — a new or updated field, or the same list re-ordered/filtered in place — and it is written out the next time the document is saved.
  • Document: the Document key names the loaded document to work on. If you leave it empty, the current document is used. It also accepts @name.
  • The document must be an object — a set of named fields. If no document is loaded, or the loaded document is a bare list, these instructions do nothing.
  • Many instructions work on a list field. Array field name names the field that holds the list. If that field is missing or isn’t a list, nothing happens.
  • Result field. Instructions that produce a value or a new list write it into a field you name (Result field name), overwriting it if it already exists.
  • Dynamic values @name: the text fields — Document key, the field-name fields, Array field name, and the text values such as Match value / Separator / Find text / Replace with — accept a saved value: type @ followed by its name and the engine substitutes the value at run time. (The numeric Constant value and the yes/no Ascending do not take @name.)
  • Saving the result too (optional). Where an instruction offers a Save … field, it also stores the result in a variable so a later instruction can use it. Leave it empty to skip that; the result is written into the document either way.
  • Text comparisons ignore case (upper/lower case treated the same).

Aggregate Array .json

Computes a single summary value from a list — sum, average, smallest, largest, or count.

When to use it: to reduce a list to one number — for example total the values list, or average a price field across a list of products.

Parameter Meaning Default Required
Document key The loaded document to work on. Empty = current document (accepts @name) (empty) No
Array field name The field that holds the list (accepts @name) values Yes
Operation sum, average, min, max, or count sum No
Result field name The field to write the computed value to (accepts @name) result Yes
Numeric field For a list of objects, the field that holds the number to use (accepts @name) (empty) No
Save result key Also save the computed value into a variable (empty) No

Important behavior: count returns how many elements the list has. The other operations read numbers — from Numeric field on each object element, or from each element directly when Numeric field is empty — and skip anything that isn’t a number. If no numbers are found (for anything other than count), nothing happens. The result is written to Result field name.


Calculate Fields .json

Performs one arithmetic operation using one or two number fields (or a fixed number), and writes the result to a field.

When to use it: to derive a value — for example compute total = price × quantity, or add a fixed tax to a subtotal.

Parameter Meaning Default Required
Document key The loaded document to work on. Empty = current document (accepts @name) (empty) No
Result field name The field to write the result to (accepts @name) result Yes
First field name The field holding the first number (accepts @name) a Yes
Operation add, subtract, multiply, divide, or mod (remainder) add No
Second field name The field holding the second number; empty = use Constant value instead (accepts @name) (empty) No
Constant value The number to use as the second operand when Second field name is empty 0 No
Save result key Also save the result into a variable (empty) No

Important behavior: the first field must exist and be a number. The second operand comes from Second field name (which must exist and be a number) if you give one, otherwise from Constant value. Dividing or taking the remainder by zero produces “not a number”. The result is written to Result field name.


Concatenate Fields .json

Joins the values of up to four fields into one text field, separated by a chosen string.

When to use it: to build a combined value — for example join firstName and lastName into fullName with a space between them.

Parameter Meaning Default Required
Document key The loaded document to work on. Empty = current document (accepts @name) (empty) No
Result field name The field to write the joined text to (accepts @name) fullName Yes
Separator The text placed between the joined values (accepts @name) (a space) No
Field 1 A field whose value to include (accepts @name) (empty) No
Field 2 A field whose value to include (accepts @name) (empty) No
Field 3 A field whose value to include (accepts @name) (empty) No
Field 4 A field whose value to include (accepts @name) (empty) No
Save result key Also save the joined text into a variable (empty) No

Important behavior: only fields that exist and have a non-empty value are included, in order (Field 1 → Field 4). If none qualify, nothing happens. The joined text is written to Result field name.


Convert Field Type .json

Changes a field’s value from one data type to another — text, whole number, decimal, or yes/no.

When to use it: to fix a value stored as the wrong type — for example turn the text "42" into the number 42 so later arithmetic works.

Parameter Meaning Default Required
Document key The loaded document to work on. Empty = current document (accepts @name) (empty) No
Field name The field whose value to convert (accepts @name) value Yes
Target type text, integer, decimal, or boolean (yes/no) text No

Important behavior: the field must already exist. If the value can’t be read as the requested type (for example "abc" as a number), it is left as text instead. For boolean, true/false — and 1/0 — are recognized. If Field name is empty, or no document is loaded (or it isn’t an object), nothing happens.


Filter Array .json

Keeps only the list elements that match a condition and drops the rest.

When to use it: to narrow a list — for example keep only the products whose category equals books, or only the numbers greater than 100.

Parameter Meaning Default Required
Document key The loaded document to work on. Empty = current document (accepts @name) (empty) No
Array field name The field that holds the list (accepts @name) items Yes
Field name For a list of objects, the field to test; empty = test each element directly (accepts @name) (empty) No
Match value The value to compare against (accepts @name) (empty) No
Comparison equals, not-equals, contains, starts-with, ends-with, greater-than, or less-than equals No
Save array key Also save the filtered list into a variable (empty) No

Important behavior: the field’s list is replaced by the elements that pass. For a list of objects, Field name picks which field to test; object elements that lack it are dropped. greater-than / less-than compare numerically (values that aren’t numbers never pass); the text comparisons ignore case. If Array field name isn’t a list, nothing happens.


Flatten Array .json

Turns a list of lists into a single flat list.

When to use it: to merge nested lists — for example combine several per-order line-item lists into one flat list of items.

Parameter Meaning Default Required
Document key The loaded document to work on. Empty = current document (accepts @name) (empty) No
Array field name The field that holds the list of lists (accepts @name) items Yes
Result field name The field to write the flattened list to (accepts @name) flatItems Yes
Save array key Also save the flattened list into a variable (empty) No

Important behavior: any element that is itself a list has its items pulled up one level; other elements are copied across as-is. The result is written to Result field name (which may be the same field to flatten it in place). If Array field name isn’t a list, nothing happens.


Format Text Field .json

Applies a text tidy-up to a string field — change case, trim spaces, or find-and-replace.

When to use it: to clean a value — for example uppercase a code, trim stray spaces from a name, or replace part of a string.

Parameter Meaning Default Required
Document key The loaded document to work on. Empty = current document (accepts @name) (empty) No
Field name The text field to transform (accepts @name) name Yes
Transformation uppercase, lowercase, trim, trim-start, trim-end, or replace trim No
Find text For replace: the text to find (accepts @name) (empty) No
Replace with For replace: the replacement text (accepts @name) (empty) No

Important behavior: the field must exist and hold text; numbers, lists and objects are left alone. Find text / Replace with are only used by the replace transformation. If Field name is empty, or no document is loaded (or it isn’t an object), nothing happens.


Group Array By Field .json

Groups a list of objects into buckets keyed by the value of a chosen field.

When to use it: to organize a list by a category — for example group a list of orders by their status.

Parameter Meaning Default Required
Document key The loaded document to work on. Empty = current document (accepts @name) (empty) No
Array field name The field that holds the list (accepts @name) items Yes
Group by field The field whose value defines each group (accepts @name) category Yes
Result field name The field to write the grouped result to (accepts @name) grouped Yes
Save group key Also save the grouped result into a variable (empty) No

Important behavior: the result is an object whose keys are the distinct values of Group by field, each holding the list of matching elements. Elements that aren’t objects, or that lack the field, go under a _unknown group. The result is written to Result field name. If Array field name isn’t a list, nothing happens.

To go over the groups, save them with Save group key and put a Repeat for each on that name: each turn is one group, with @name for the group’s name and value for its list of records — so an inner loop over <group>.value walks the records of the group it is on.


Sort Array .json

Reorders the elements of a list — alphabetically, numerically, or by a field inside each element.

When to use it: to order a list — for example sort names A→Z, or sort a list of products by their price.

Parameter Meaning Default Required
Document key The loaded document to work on. Empty = current document (accepts @name) (empty) No
Array field name The field that holds the list (accepts @name) items Yes
Sort by field For a list of objects, the field to sort by; empty = sort by the elements themselves (accepts @name) (empty) No
Ascending Yes = A→Z / low→high; No = the reverse Yes No
Ascending (from variable) Reads the yes/no value from a saved value (empty) No
Save array key Also save the sorted list into a variable (empty) No

Important behavior: if every value is a number the list is sorted numerically; otherwise it is sorted alphabetically (ignoring case). For a list of objects, Sort by field chooses the field to compare. The field’s list is replaced with the sorted one. If Array field name isn’t a list, nothing happens.


Transform Array Elements .json

Applies a text transformation to every text element of a list — the list version of Format Text Field.

When to use it: to tidy every entry at once — for example uppercase every tag in a tags list, or trim spaces from each entry.

Parameter Meaning Default Required
Document key The loaded document to work on. Empty = current document (accepts @name) (empty) No
Array field name The field that holds the list (accepts @name) items Yes
Transformation uppercase, lowercase, trim, trim-start, trim-end, or replace trim No
Find text For replace: the text to find (accepts @name) (empty) No
Replace with For replace: the replacement text (accepts @name) (empty) No

Important behavior: the transformation is applied to each text element in place; non-text elements (numbers, objects, lists) are left untouched. Find text / Replace with are only used by the replace transformation. If Array field name isn’t a list, nothing happens.


This documentation is the help of the application, and it comes underCreative Commons Attribution 4.0.