Zauberfisch/sapphire — comment on commit 442d19bf521c56f1cffb17fdbe8e60ee84f9b510
File:  line 0
By chillu:

Please send the correct type, maybe that already fixes it. And use our json_encode() wrapper:
{{{
$response = new SS_HTTPResponse(Convert::raw2json(array($return)));
$response->addHeader('Content-Type', 'application/json');
return $response;
}}}

Otherwise, use a standard encoding rather than custom stuff like ::lt:: - Convert::raw2html() should do.
You can decode this again with something like this: http://css-tricks.com/snippets/javascript/htmlentities-for-javascript/