public Response buildResponse() {
    int status = HttpStatus.OK_200;        // Server ok.
    if (map.containsKey("error"))
     {
      status = HttpStatus.INTERNAL_SERVER_ERROR_500; // Generic http server error.
    }
    Object o = map.get("errorCode");
    if (o != null) {
      if(hiveError2HttpStatusCode.containsKey(o)) {
        status = hiveError2HttpStatusCode.get(o);
      }
    }
    return buildResponse(status);
  }
Turn the map back to response object.
hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/JsonBuilder.java