Data Action - response that includes $

Hi All,

We are trying to retrieve data from a dat action when the child element is labelled "$", currently attempting this fails.

Example response (Appreciate this is not the full response but a snippet as example):

{
"secureDataReadResponse": {
"sessionData": {
"entry": [
{
"@name": "Group.Req",
"$": "false"
},
{
"@name": "Group.Length",
"$": "3"
},

So for example we are trying to capture the "$":"false" and use the false value in architect

Have tried the below but it doesnt seem to work:
$.secureDataReadResponse.sessionData.entry[1].$

Is this possible?

Thanks Luke

Hey Luke,

The only problem I could find is that you have entry[1] instead of entry[0]. Arrays are indexed off of 0 instead of 1.

To get there I first put in your JSON example into jsonline.com and added ] and } until it was valid JSON

{
	"secureDataReadResponse": {
		"sessionData": {
			"entry": [{
					"@name": "Group.Req",
					"$": "false"
				},
				{
					"@name": "Group.Length",
					"$": "3"
				}
			]
		}
	}
}

The I put that into http://jsonpath.herokuapp.com/ and used your JSON path, which returned "3". Changing your entry[1] to 0 instead returned "false"

--Jason

Hello,

if you are trying to capture the "$":"false", it is the item with index 0 (entry[1] corresponds to the item with "$": "3").

You can use the following: "$.secureDataReadResponse.sessionData.entry[0].[\"$\"]"

Just for sake of fun :slight_smile:
You can also get the value searching on @name == Group.Req instead of using static index for it.
Something like:

{
  "translationMap": {
    "capturedValuesAsArray": "$.secureDataReadResponse.sessionData.entry[?(@.[\"@name\"] ==\"Group.Req\")].[\"$\"]"
  },
  "translationMapDefaults": {
    "capturedValuesAsArray": "[]"
  },
  "successTemplate": "{\"value\": ${successTemplateUtils.firstFromArray(\"${capturedValuesAsArray}\", \"${esc.quote}NOTFOUND${esc.quote}\")} }"
}

Regards,

Thank you both,

Appologies I was using 1 for the array

Jerome, thank you very much, that was the issue I was facing, how to put the $ into the response, that worked perfectly.

Thank you both for your help!