removed all newlines from output so it's one long json string.

Noticed that when json was sent with newlines it was giving error messages indicating malformed json was being submitted. This submits the entire json object as a single string and consistently works for me.