I'm trying to parse a Web Response which is a JSON object. I saw several suggestions to use text functions to extract substrings from the response. However, it doesn't appear to work as described. The output is just blank. I've also tried creating a variable to force it to text, but the output is still blank.
tempWebResponse = {{webResponse.body.results}}
UserId = {{#debug}}{{tempWebReponse.substring(8, 15)}}{{/}}
Audit Log:
Action details:
["10099"]
Send web request
Successfully published web request
Log action
Log
tempWebResponse: {users={1220280={id=1220280, first_name=Steve,...}
Create variable
Debug message
Log action
Log
UserID:
I think I just had a typo above. Today, I'm able to use the text functions to extract substrings from the JSON object.
Glad to know it works now. :-)
Perhaps you can share the solution here, and mark this thread as the Accepted answer, it might help another member from the community reach the solution quicker.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here's the working example:
Create variable:
usersWebResponse = {{webResponse.body.results.users}}
Create variable:
userId = {{usersWebResponse.substringBetween("{","=")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Steve Kohrs ,
Assuming this is your webresponse :
{users={1220280={id=1220280, first_name=Steve,...}
You should be able to access the users id using this:
{{webResponse.body.1220280.id}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.