TestProject Forum

Get value from json response

Hello there.
I’m trying to extract value “url” from json response, via jsonPath.
I’ve created parameter with value $…url, which I’ve assigned to “JsonResponse” field in “HTTP POST Request” step.
But, after sending request, I’m getting full response in parameter’s “Current value”

Response:

{
    "id": 111,
    "url": "https://test-url.com",
    "expire": "2021-09-09 11:27:41"
}

Hello @jurijs.bekajevs,
here is how to get the JSON path response from the post API call

for example, how to get only the id of Post request to execute a test
the JSON path input should be the Jayway JsonPath of the value you want to extract from the response

the format of the response is:

{
“id”: “Test_ID”,
“type”: “TEST”,
“name”: “Test_Name”,
“executionStart”: “2021-09-12T11:58:56.1487776Z”
}

the Jayway JsonPath of id is $.id

in the output JsonResponse of the action, we should put the output parameter that will receive the JsonPath

after running this step the JSON value of id will be outputted to the parameter id

Please let me know if that worked for you.

2 Likes

Yaeh, it helped. Thank you! :slightly_smiling_face: