Referencing Field Names and Field Paths
When a is valid for preview, you can generally select fields from a list. When a list is not available or when you are defining a new field name, you need to use the appropriate format for the field name.
Tip: After running preview for a , you
can also copy a field path from the preview results or when you view
the input and output schema for a stageinput and
output schema for a stage.
To reference a field, you specify the path of the field. A field path describes a data element in a record using a syntax similar to files in directories. The complexity of a field path differs based on the type of data in the record:
- Simple maps or JSON objects
-
With simple maps or JSON objects, the fields are one level removed from the root. Reference the field as follows:
/<field name>
So, to reference a CITY field in a simple JSON object, enter/CITY
. A simple expression that calls the field might look like this:${record:value('/CITY')}
- Complex maps or JSON objects
-
To reference a field in a complex map or JSON object, include the path to the field, as follows:
/<path to field>/<field name>
For example, the following field path describes an employeeName field several levels deep in a JSON object:/region/division/group/employeeName
. An expression that calls the field might look like this:${record:value("/region/division/group/employeeName")}
- Arrays or lists
- To reference a field in an array or list, include the
index and path to the field, as
follows:
[<index value>]/<path to field>/<field name>
- Text
- To reference text when a record is a line of text, use
the following field name:
/text