asExpressionString

asExpressionString(path: Path): String

Transforms a Path value into a string representation of the path.

Introduced in DataWeave version 2.2.2.

Parameters

Name Description

path

The Path value to transform into a String value.

Example

This example transforms a Path value into a String representation of a selector for an attribute of an object.

Source

%dw 2.0
import * from dw::util::Tree
output application/json
---
asExpressionString([
        {kind: OBJECT_TYPE, selector: "user", namespace: null},
        {kind: ATTRIBUTE_TYPE, selector: "name", namespace: null}
    ])

Output

".user.@name"

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub