The
split-jsonpath
transformation extracts values from a
specified location in the JSON value of a specified property. The
transformation replaces the JSON value of the property with the extracted
values. No other properties are created or modified by this transformation.
For example, suppose that the following JSON has been assigned as the
value of a property named
product.jsondata
:
{ "product.name": "Suede Shoes", "product.childSKUs": [ { "sku.id": "1000-R-M8", "shoe.color": "Red", "shoe.size": "8" }, { "sku.id": "1000-B-M8", "shoe.color": "Blue", "shoe.size": "8" }, ... ] }
The following split-jsonpath transformation replaces the JSON value of
the property
product.jsondata
with values that it extracts from the
JSON value:
{ "ecr:type": "attributes-owner-folder", "product.jsondata": { "ecr:type": "dimension", "isAutogen": true, "indexingTransforms": [ { "transform": "split-jsonpath", "sourcePropertyNames": [ "product.jsondata" ], "jsonPaths": [ "$['product.childSKUs'][*]['sku.id]", "$['product.childSKUs'][*]['shoe.size']", "$['product.childSKUs'][*]['shirt.size']" ] } ] } }
The split-jsonpath transformation assigns the extracted values to product.jsondata as follows:
"product.jsondata": "1000-R-M8", "product.jsondata": "8", "product.jsondata": "Red", "product.jsondata": "Blue"
The following table lists the properties of a
split-jsonpath
transformation:
Property |
Data type |
Default value |
Comments |
"transform" |
String |
N.A. |
Required. Must be set to "split-jsonpath" Example: |
"sourcePropertyNames" |
JSON Array |
The attribute name to which this transform belongs |
Optional. Example:
|
"removeSourcePropertyValues" |
Boolean |
True when the source property is identical to the attribute. False otherwise. |
Optional. Example:
|
"ignoreDuplicatePropertyValues" |
Boolean |
True |
Optional. Example:
|
"splitPaths" |
JSON Array |
Not applicable |
Required when it is not an identity transform. The array
values must comply with
Example:
Note: When splitPaths is not specified for an identity transform, then the source property values will be parsed as a JSON Path and the resulting JSON key:value pairs will be added to the record. |