Hello,
Here is my Json Response body
body=
{
“settingsResponse” : [
{
“identifier” : “MyIdentifier”,
“values” : [
{
“identifier” : “Section1”,
“values” : [
{
“identifier” : “UniqueCode”,
“value” : “12345”
}, {
“identifier” : “accountNumber”,
“value” : “123456789”
}, {
“identifier” : “accountNickname”,
“value” : “My Account”
}, {
“identifier” : “accountType”,
“value” : “Test”
}, {
“identifier” : “enabled”,
“value” : “true”
}, {
“identifier” : “Threshold”,
“value” : “100.00”
}, {
“identifier” : “Threshold”,
“value” : “20.00”
}, {
“identifier” : “TokenCode”,
“value” : “WXdSdFl0SkF1NTB2SkMvYXNXNHVaQkxpJUVFxdVFKb0tJM0JOcU9WaHRhMHdqczVqb0l5\ndExPdFZtY0g2clNZRU5VQ3AxNQp3MzFnM3JLYjRRPT0=”
} ]
},
I am Trying to Read the TokenCode Value, have tried below formats.
-
.check(jsonPath(“$.settingsResponse.identifier.values.identifier.values[?(@.identifier == ‘TokenCode’)].value”).saveAs(“TokenCode”))
-
//.check(jsonPath(“$…value”).findAll.saveAs(“TokenCode”))
Response of 1 fails , can you please help whats wrong ?
Response of 2 returns all the values
“identifier”: “TokenCode”,
“value”: "Vector(12345, 123456789, My Account, Savings, true, 100.00, 20.00, WXdSdFl0SkF1NTB2SkMvYXNXNHVaQkxpJUVFxdVFKb0tJM0JOcU9WaHRhMHdqczVqb0l5
dExPdFZtY0g2clNZRU5VQ3AxNQp3MzFnM3JLYjRRPT0=
But \N is missing and it consider \n as new Character while Writing the value in TokenCode.
When i pass the Variable ${TokenCode(7)} in the value , Below is the response
“identifier”: “accountToken”,
“value”: “WXdSdFl0SkF1NTB2SkMvYXNXNHVaQkx2cUpJUVFxdVFKb0tJM0JOcU9WaHRhMHdqczVqb0l5
dExPdFZtY0g2clNZRU5VQ3AxNQp3MzFnM3JLYjRRPT0=”
and the request fails as |N is missing and considered as new Line.
Any help is highly appreciated.
Thanks
Prakash