   [java-json]
   (json/read-str (.toString (.asJsonNode java-json))))
 
+(defn xdm-var->str
+  "Returns a String representation of the given XDM variable"
+  [xdm-var]
+  (hash-map (.toString (.getName xdm-var))
+            (.toString (.getValue xdm-var))))
+
 (def types
   "Default mapping from MarkLogic XCC types (e.g. those that might be
   returned in a query's result set) to Clojure functions intended to

    :timeout-millis
    :timezone})

(defn- request-options
  "Creates a Request Options object (to pass to a Request or a
  Session) out of the given options map. See `valid-request-options`
  for supported keywords."

(defn submit-request
  "Construct, submit, and return raw results of request for the given
  `session` using `request-factory` and `query`. Modify it
  with (possibly empty) `options` and (String) `variables`
  maps. Applies type conversion to response according to defaults and
  `types`."
  [request-factory session query options variables types]
  (let [ro      (request-options options)
        request (reduce-kv (fn [acc vname vval]
