Don't get lost: IMan Guides » IMan User Guide » Readers » JSON Reader

JSON Reader

The JSON Read:

  • Enables data to be read from either an HTTP URL via a GET operation, a file location or an email.
  • Can consume virtually any JSON data which has a recurring object structure.
  • Uses a JPath syntax, however it is not necessary to mark any of the end nodes with the array [] syntax.

Building the JSON Read Transform

JSON is in a hierarchical data format. Hierarchical data is represented through a parent-child property relationship.

The example above is some JSON data containing two sales orders. Steps to import such data:

  1. Navigate to the end property of the Entry Point JSON Path expression. The Entry Point is where the topmost parent transaction type begins to recur.

In the example above the properties marked in red represent the Entry Point.

  1. The JSON Path expression specified in the top parent is appended to Entry Point JSON Path.

In the example, the top parent transaction type is the “orders” property marked in blue.

  1. The JSON Path expression of each of the fields is then appended to the JSON Path of the transaction type.
  2.  The value of the property for the JSON Path expression becomes the IMan field value.
    1. Properties which are nested within objects can be referenced through a multi-segment JSON Path, for example the “first_name” and “last_name” properties marked in green.
  3. For each of the child transaction types append their JSON Path expression to the JSON Path expression of their parent transaction type.

In the example the order details are located in the “line_items” array property, marked in orange.

  1. For each of the fields in the details repeat the actions as described in step 3.
  2. Repeat steps 5 & 6 for each of the transaction types.

FIELD MAPPING TAB

JSON Entry Point

The JSON entry point refers to the JSON property where the transactions begin to recur.

In the example above this refers to the “document” property marked in red.

If there are no leading properties prior to the recurring array property this field can be left blank or marked with a single forward slash.

New Transaction Id

To add transaction types, enter a recognisable name into this field, and press the Add button.

Add Button

The Add button creates a new transaction type of the name provided in the ‘New Transaction Id’ field.

Transaction Type Drop Down

Each of the transaction types created within the hierarchy are listed in this drop down. Altering the value automatically saves any changes to the currently selected transaction type and changes the transaction type being edited.

Parent Id

Set the value of this drop down to the parent transaction type of the currently selected transaction type.

Edit Button

Pressing the Edit Button will display the transaction type setup page.

Remove Button

Deletes the selected transaction type from hierarchy.

Transaction Setup

Transaction JSON Path

The JPath expression of the transaction type.

The JPath expression is relative to either the entry point, if the transaction type is the top transaction or the parent transaction type to the one being edited.

In the example the top transaction JSON Path refers to the “orders” Array property (marked in blue), where each object within the array represents a single order.

The “line_items” array (marked in orange) denotes the order details where each object in the array represent a single line item.

Field Mapping

Field Name

The name to identify the field.

Type

The type of the field.

Relative

Indicates whether the field should use a relative or an absolute path.

JSON Path

If the field is marked as relative, this is the JPath expression for the field.

If the field is not relative, it is an absolute path. This allows properties that do not fit into the child-parent property relationship to be imported into the dataset.

If a property is nested within another object or set of objects, the property’s path is denoted by specifying each of the properties names separated by a forward slash.

In the example above the “first_name” and “last_name” properties are both nested within the “customer” object, so the JPath expression is:

“customer/first_name” and “customer/last_name” respectively (marked in green).

Delete Button

Deletes the field from the transaction type.