TestProject Forum

Get value of id without [""]

So I have this json response trying to use jway json path but when i save the output of id it returns it inside an array.

{
“items”: [{
“id”: “01788333-45a5-46e7-bb84-a7e79e4053e2”,

I’m using $…id as it’s the only one returned, how can i get just the id without [""]

Hello @elsidaliaj,

In the HTTP request, you can save the response in the “JsonResponse” output field,
and it should remove the (" ") characters from the number, and to remove the brackets you should specify the index of the item in the JsonPath, like [0].

Another way to achieve this is by using this action:

image

This will remove this chars ( [, ], ") from the string:

1 Like

yeah for some reason when I do $…id[0] it returns empty, but i’ll try the string step.

I also just tried this trying to do the [0].id in the jsonPath response and this did not work.

However, I was successfully able to do it using the addon of
Gets value in JSON using jsonPath Syntax.

I returned an object in the original jsonPath API call, which returned back an array of one object. Then in the above addon I did a jsonPath of $.[0].id then set it back to my variable. Works nicely.