You should use body
attribute instead of the return value of the get
(HTTParty::Response
).
url = 'https://www.linkedin.com/countserv/count/share?url=' + url + '&format=json'
count = JSON.parse(HTTParty.get(url).body)["count"]
# ^^^^^