I have a shi**y API, which returns a broken JSON after GET request with HTTParty.
GET HTTParty.get('url/login/success/', headers: {cookie: "JSESSIONID=ID"})
returns JSON::ParserError (765: unexpected token at)
and response.body is
"{\"head\":{\"apikey\":null,\"sessionid\":\"ID\",\"timestamp\":1551772335837,\"sessiontimeout\":1551775035837,\"wishlistItemsCount\":0,\"basketItemsCount\":0,\"loggedIn\":true,\"role\":\"C\"},\"data\":{\"user\":{\"profile\":{\"title\":\"Title\",\"firstname\":\"Name\",\"lastname\":\"Lastname\",\"street\":\"Street\",\"street2\":\"number\",\"postalcode\":\"code\",\"city\":\"City\",\"customerID\":\"ID\",\"customerType\":xx}},\"abandonedBasket\":false},\"messages\":[{\"code\":\"url.api.login.success\",\"statusCode\":200,\"description\":\"OK\"}]}{\"head\":{\"apikey\":null,\"sessionid\":\"ID\",\"timestamp\":1551772335841,\"sessiontimeout\":1551775035841,\"wishlistItemsCount\":0,\"basketItemsCount\":0,\"loggedIn\":true,\"role\":\"C\"},\"data\":{},\"messages\":[{\"code\":\"url.api.general.error\",\"statusCode\":500,\"description\":\"Es ist ein interner Fehler aufgetreten. Bitte versuchen sie es später noch einmal.\"}]}"
Is there any possibility to fix the response's JSON for user to log in and use his account normally?
The alternative I have is using curl
inside code, but I want to avoid it