Dear All,
In this blog, I will try to make you feel comfortable in understanding how you can manage transformations with graphical and JSON text editor. Are you interested in knowing how to map between Source & Target attributes ?
The source path attribute addresses in the internal representation and the target path attribute addresses in the target system are displayed vertically - one below the other.
The transformation expressions and functions are listed in individual lines below the respective sourcePath and targetPath attribute they are applicable for.
Syntax coloring and syntax validation are enabled by default. |
JSONPath is a path expression language for JSON. It is used to query data from JSON datasets and it is similar to XPath query language for XML documents.
JsonPath uses special notation to represent nodes and their connections to adjacent nodes in a JsonPath path.
A mapping configuration is a name-value pair (that is, a transformation expression and its value)
As the name implies JSONPath is heavily inspired by XPath and offers similar syntax and querying capabilities
Let's take a look at all of the available operators and some examples:
JSON filter Description
$ | the root object/element |
@ | the current object/element |
. or [] | child operator |
.. | recursive descent. JSONPath borrows this syntax from E4X. |
* | wildcard. All objects/elements regardless their names. |
[] | subscript operator. XPath uses it to iterate over element collections and for predicates. In Javascript and JSON it is the native array operator. |
[,] | Union operator in XPath results in a combination of node sets. JSONPath allows alternate names or array indices as a set. |
[start:end:step] | array slice operator borrowed from ES4. |
?() | applies a filter (script) expression. |
() | script expression, using the underlying script engine. |
We now have a good understanding of the JsonPath functionality. So, let's look at an example.
Example - JSON Payload from SAP IAS for Individual user
{ "id": "aafea146-1d35-476c-a694-d8cdf7de31f8", "meta": { "created": "2022-07-18T13:01:06Z", "lastModified": "2022-07-18T13:01:06Z", "location": "https://<iastenant>.accounts.ondemand.com/scim/Users/aafea146-1d35-476c-a694-d8cdf7de31f8", "version": "2118f009-97bb-4b3e-9b57-48ac3c62b833", "resourceType": "User" }, "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User", "urn:ietf:params:scim:schemas:extension:sap:2.0:User" ], "userName": "yoga", "name": { "familyName": "Muthaiah", "givenName": "Yogananda" }, "active": true, "emails": [ { "value": "abc@domain.com", "primary": true } ], "urn:ietf:params:scim:schemas:extension:sap:2.0:User": { "emails": [ { "value": "abc@domain.com", "primary": true } ], "userUuid": "aafea146-1d35-476c-a694-d8cdf7de31f8", "mailVerified": false, "userId": "P000042", "status": "active" } }
Go to JSON Path - Insert your JSON Payload to get JSON Schema Path for mapping this into your Transformation
Example for Schemas
Example to filter if email is a PrimaryExample for filtering userName fieldExample for filtering customAttribute fields.
https://goessner.net/articles/JsonPath/index.html#e2
https://github.com/json-path/JsonPath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
26 | |
13 | |
12 | |
11 | |
9 | |
9 | |
7 | |
5 | |
5 | |
5 |