removing endline from telnet and json parsing