Fix API response header for JSON content type and the return of JSONP data

The API should return application/json Content-Type for JSON data instead of application/html. Tornado expects a dict in order to JSON encode and send header "Content-Type:application/json". SR already encodes data plus it supports JSONP. So, as a hack to the Tornado behaviour compared to CherryPY, wrap the encoded data, and hack in a test at Tornado def write() to unwrap, skip encoding, and set the correct header.