removed all newlines from output so it's one long json string.
In addition to removing newlines from the regular output, also parse the output of the command executed to turn newlines into spaces, unless it's the last character of the line.
Modified tests to expect one line output. Also worked around some sed weirdness to make escaping backslashes and quotes work correctly.
Merge pull request #7 from wvaladez/master

Removes all newlines from output. Checks the command output as well so as to turn newlines into spaces, with the exception of the last character of the output.