Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
yogananda
Product and Topic Expert
Product and Topic Expert

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 ?

How to Manage Transformations

  1. Access the Identity Provisioning administration console.
  2. From the UI home page, choose a tile: Source SystemsTarget Systems or Proxy Systems.
  3. Select a system from the left panel and go to the Transformations tab.
  4. The graphical editor is displayed by default. You can switch to the JSON editor by choosing the code-bracket icon.
  • Working with the JSON editor allows you to type changes and perform operations like select, cut, copy and paste the transformation code.Choose Edit. You need to work in edit mode to add, modify and delete entities and their configurations.
  • Working with the graphical editor allows you to graphically model your changes.
  • Save your changes.

Understanding of Transformations in Source & Target

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.

 





Breaking down Transformations with help of JSON Path

https://jsonpath.com/


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.


References

https://goessner.net/articles/JsonPath/index.html#e2

https://github.com/json-path/JsonPath

4 Comments