checking the (json) response against the request data

I want to check that the userid I am requesting is being returned in the response (json)

I guess I have to use .check(jsonPath("$. is like ${userID}.

My json response is below and I want to check that the “number”: “123”

`


1. {
1.    "resultCode": "SUCCESS",
1.    "errorCode": null,
1.    "errorMessage": null,
1.    "profile":
1.    {
1.        "id": "555555555",
1.        "fullName": "Jason Xeml",
1.        "memberships":
1.        [
1.            {
1.                "name": "thename",
1.                "number": "123",
1.                "scanNumber": "555-555-555-555"
1.            }
1.        ]
1.    }
1. }

`

is equivalent to the ${userID} below:

`

.exec(
http(“getUser”)
.get("/user/account")
.header( “X-Token”, “${userID}” )
.check(status.is(200))
.check(jsonPath("$.resultCode").is(“SUCCESS”))

.check(jsonPath("$.profile.memberships[0].number" = “${userID}” )
or:
.check(jsonPath("$.profile.memberships[0].number" equals “${userID}” )
or?.. how?
)

`

I think the first part “$.profile.memberships[0].number” works, but how do I say that is must be equivalent to the requests ${userID} ?
using equals? using = or how?

Magnus

I am not 100% on this but try :-
**.check(jsonPath("$.profile.memberships[0].number").find.is("${userId}")**

I seems:

`
.check(jsonPath("$.profile.memberships[0].number").is("${userID}"))

`

works!
I can try your suggestion also.

Thanx!

.find is implied if it is not explicitly specified.

Hi,
What does that mean?

(.find is implied if it is not explicitly specified)

It means that specifying

.check( jsonPath( path ).find.is( value ) )

is exactly the same as specifying

`
.check( jsonPath( path ).is( value ) )

`

Thank you (again), John!