Added Access-Control-Allow-Origin header and NaN/Infinity encoding to JSON responses