Dealing with a RESTful API that returned JSON in the body to my Robot Framework test caused me no end of grief. Since the response always came back with the following:
Originally I thought, it's just a JSON response, I can deal with it.\xef\xbb\xbf{"account_organizations": [
Oh no.
Not at all.
Turns out what I was getting ended up being byte order markers that were messing up the JSON compare I was trying to do. Knowing what I was to get back was one thing, comparing that with the body of the response was another thing since the byte order markers did not behave like a regular list as I thought it was. This turned out to be a dict, since Robot Framework basically is Python we have to be Pythonic here.
So, treating that as a dict we get the 3rd index from the list:
${l_response_body[3:]}THAT now pulls the right values for comparison.
I also run this against a make unicode Python library, just in case. So in Robot I use the following to cover it all:
${l_response_body} Get Response Body${l_decoded_body} = make_unicode ${l_response_body[3:]}
So all is good with the world, for now.