asyrjasalo / RESTinstance

Robot Framework library for RESTful JSON APIs
https://pypi.org/project/RESTinstance
GNU Lesser General Public License v3.0
205 stars 84 forks source link

Question: when using RESTinstance and store String to variable, it store value with square brackets and single quotes, how can I remove square brackets and single quotes at beginning and end? #71

Closed aedahh closed 5 years ago

aedahh commented 5 years ago

Hello, when using RESTinstance and store String to variable, it store value with square brackets and single quotes, how can I remove square brackets and single quotes at beginning and end?

POST /login {"username":"user", "password":"pass"} Integer response status 200 ${resp} = String $.response.token log to console response token is: ${resp} # this gives [' zdWIiOiJhaW50 '] I just want zdWIiOiJhaW50

I need to pass the token to next request, but it failing due to extra square brackets and single quotes.

aedahh commented 5 years ago

I ended up using split string to characters into an array then accessing the first item in array, this way it got rid of the square bracket and single quote.