Application Delivery Management
Application Modernization & Connectivity
CyberRes
IT Operations Management
jp:read(String jsonString, String jsonPath, boolean throwException)
jp:readAttributes(String jsonString, boolean throwException)
jp:readAttribute(String jsonString, int index, boolean throwException)
<rule>
<description>jsonpath</description>
<conditions>
<and>
<if-operation mode="nocase" op="equal">driver-operation-data</if-operation>
<if-xpath op="true">$current-op/request/value/text() != ""</if-xpath>
</and>
</conditions>
<actions>
<do-set-local-variable name="oldjson" scope="policy">
<arg-string>
<token-xpath expression="$current-op/request/value/text()" />
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="attributes" scope="policy">
<arg-string>
<token-xpath expression="jp:readAttributes($oldjson,false)" />
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="attributes" scope="policy">
<arg-node-set>
<token-split delimiter=",">
<token-local-variable name="attributes" />
</token-split>
</arg-node-set>
</do-set-local-variable>
<do-set-local-variable name="newjson" scope="policy">
<arg-string>
<token-text xml:space="preserve">{</token-text>
</arg-string>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-local-variable name="attributes" />
</arg-node-set>
<arg-actions>
<do-set-local-variable name="jpath" scope="policy">
<arg-string>
<token-text xml:space="preserve">$.</token-text>
<token-local-variable name="current-node" />
<token-text xml:space="preserve">[0].add[0]</token-text>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="newjsonvalue" scope="policy">
<arg-object>
<token-xpath expression="jp:read($oldjson,$jpath, false)" />
</arg-object>
</do-set-local-variable>
<do-trace-message>
<arg-string>
<token-local-variable name="newjsonvalue" />
</arg-string>
</do-trace-message>
<do-set-local-variable name="newjson" scope="policy">
<arg-string>
<token-local-variable name="newjson" />
<token-text xml:space="preserve">"</token-text>
<token-local-variable name="current-node" />
<token-text xml:space="preserve">":"</token-text>
<token-local-variable name="newjsonvalue" />
<token-text xml:space="preserve">",</token-text>
</arg-string>
</do-set-local-variable>
</arg-actions>
</do-for-each>
<do-set-local-variable name="newjson" scope="policy">
<arg-string>
<token-substring length="-2">
<token-local-variable name="newjson" />
</token-substring>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="newjson" scope="policy">
<arg-string>
<token-local-variable name="newjson" />
<token-text xml:space="preserve">}</token-text>
</arg-string>
</do-set-local-variable>
<do-strip-xpath expression="$current-op/request/value/text()" />
<do-append-xml-text expression="$current-op/request/value">
<arg-string>
<token-local-variable name="newjson" />
</arg-string>
</do-append-xml-text>
</actions>
</rule>
<driver-operation-data class-name="User" command="modify" event-id="nsa1#20170825212752#1#1:6abf5e4c-34b9-4406-f58a-4c5ebf6ab934" src-dn="\PROVO\data\users\json1">
<request>
<url-token association="eAPEDMMapk76ingDxAzDGg=="/>
<header content-type="application/json"/>
<value>{"Description":[{"add":["Identity Management"]}],"Title":[{"add":["Engineer"]}],"L":[{"add":["US"]}]}</value>
</request>
</driver-operation-data>
jp:readAttributes($oldjson,false)
Action: do-for-each(arg-node-set(token-local-variable("attributes"))).
Rest Driver ST: arg-node-set(token-local-variable("attributes"))
Rest Driver ST: token-local-variable("attributes")
Rest Driver ST: Token Value: {"Description","Title","L"}.
Rest Driver ST: Arg Value: {"Description","Title","L"}.
arg-string("$." token-local-variable("current-node") "[0].add[0]")
token-xpath("jp:read($oldjson,$jpath, false)")
<driver-operation-data class-name="User" command="modify" event-id="nsa1#20170825212752#1#1:6abf5e4c-34b9-4406-f58a-4c5ebf6ab934" src-dn="\PROVO\data\users\json1">
<request>
<url-token association="eAPEDMMapk76ingDxAzDGg=="/>
<header content-type="application/json"/>
<value>{"Description":"Identity Management","Title":"Engineer","L":"US"}</value>
</request>
</driver-operation-data>