title: Handle JSON-only API with BaseX XQuery code
body: <p>I recently took over an older code project for a new job, and this project extensively uses XML databases stored in BaseX. The core project is a Node web application delegating various database operations to XQuery functions interacting with the BaseX databases.</p>
  <p>Recently, an external API that we were using to cross-publish our public data (a sort of public data hub) completely changed its API, and only accepts JSON encoding for its REST API calls. This is a problem for us, because we were using our BaseX/XQuery methods to shape XML-encoded REST calls and it worked really well.</p>
  <p>I looked thoroughly at the documentation for various modules of BaseX (JSON &amp; HTTP modules in particular) but it does seem like XML elements are the only things accepted by the <code>http:send-request</code> function we are using to make our calls in XQuery. BaseX is apparently able to parse and serialize JSON data but I could not find anything to <em>send</em> JSON data for HTTP requests.</p>
  <p>I was thinking of performing this external publication in the Node app code instead of the XQuery methods, but the contents of the publication are relying on various data fetched from the database, so it does feel a little counter-productive.</p>
  <p>Am I missing something here? Is it possible to use XML data from BaseX databases to shape and send JSON data in XQuery?</p>
  <p>Thanks in advance.</p>