What makes it too long? Too much trailing space? Too much preceding space? Conveted entities? You'll need to figure out what is making it longer than expected.
Lols, glad you got it figured out. Jeez I was away for almost an hour? Awesome.
You should be safe using encoding on the *data* you are giving to the JSON, but it likely wouldn't be necessary. Never (for lack of a better term) molest the data after its been converted by something like json_encode. That's like changing the data directly given during a pack command and hoping you can read it out.