REST API/dev site: fix the example responses to display the results properly by changing the sourcecode shortcode to display as javascript instead of php since it's a json format not a PHP array.

Also cleans up some of the code that generates this response and caches it, to prevent a possible error, improve readibility and to use the right sanitization function.

props stephdau for pointing me in the right direction

Merges r94022-wpcom.