User Tools

Site Tools


transformations:extractjson

EXTRACT JSON PROPERTIES

Category: Transform / Web


Description

This action creates new columns with values from selected JSON JSON properties contained within a single-cell text string typically received from an API call.


Action settings

Setting Description
Source JSONSelect the column that contains the JSON text.
New column namesChoose the mode for creating and naming columns from the selected JSON object. Options: Property name
or Explicit. See below for details.
JSON pathSelect the specific JSON path(s) to extract into the defined columns. See below for details.
PositionChoose where the new columns will appear in the table. Options: Rightmost, Leftmost, or After column (and
select the column the new columns will appear after).
If JSON path not foundChoose how EasyMorph will respond to situations when the selected JSON path is not found in the dataset.
Options: Fail (and halt the workflow) or Return error (generate an error and continue the workflow).


New column names "Property name" settings

This mode will create a new column with the same name as the path selected in the "JSON path" setting.


New column names "Explicit" settings

In this mode, individual columns are created, and manually named, based on the selected JSON paths.



Examples

Source JSON: Column name is "Response-Body" (all text contained within a single cell).

{"Employees":[{"name":"Doug", "id":7, "dept":"Accounting"},{"name":"Sue","id":2, "dept":"HR"},{"name":"Mark",
 "id":5, "dept":"Maintenance"},{"name":"Tamara", "id":1, "dept":"Administration"}]}


Action parameters:

Source JSON is "Response-Body"
New column names is "Property name"
JSON path is "Employees"


Result: (Contained within a single cell.)

[
  {
    "name": "Doug",
    "id": 7,
    "dept": "Accounting"
  },
  {
    "name": "Sue",
    "id": 2,
    "dept": "HR"
  },
  {
    "name": "Mark",
    "id": 5,
    "dept": "Maintenance"
  },
  {
    "name": "Tamara",
    "id": 1,
    "dept": "Administration"
  }
]


See also

transformations/extractjson.txt · Last modified: 2022/12/04 16:25 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki