Improved JSON response error handling to not add an errors response if it is a jsonrpc call, and to handle response objects other than Map