Hi Christian,
OK, I understand now.
The issue occurred in a JSON API that outputs simple maps without
sequence values. I lost sight of the distinction between maps and JSON
objects, and mistakenly assumed the problem was with the function rather
than with serialization.
Simply looking up the actual error code (or paying attention to its SERE
prefix) should have kept me from asking in the first place. Sorry for
the noise.
But thank you for the quick reply.
Best,
Tom
On 11/15/2025 7:22 PM, Christian Grün wrote:
Hi Tom,
The error is caused by your intent to serialize the map as JSON. You
should get a successful response if you replace 'json' with 'basex' or
'adaptive'.
If you want to output data as JSON, it is handy indeed if value lists
are represented as arrays. However, most features of XQuery treat
sequences as first-class citizens, and JSON serialization is just one
use case.
Hope this helps,
Christian
____________________________________
Dr. Christian Grün, BaseX GmbH, basexgmbh.de <http://basexgmbh.de/>
|-- Firmensitz: Obere Laube 73, 78462 Konstanz
|-- Registergericht Freiburg, HRB:708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Phone:+49 7531 28 28 676, Mail: [email protected]
------------------------------------------------------------------------
*From:* Tom De Herdt via BaseX-Talk <[email protected]>
*Sent:* Saturday, November 15, 2025 5:50:27 PM
*To:* BaseX <[email protected]>
*Subject:* [basex-talk] Issue with request:parameter-map and repeated
query parameters
Hello,
I’ve encountered an issue with the new request:parameter-map function in
BaseX. It throws an error when called with a query string that contains
repeated parameters, such as ?a=1&a=2:
[SERE0023] Value has more than one item.
Is this behavior expected? As far as I know, query parameters may be
repeated. For example, this can occur when submitting a form with
checkboxes using the GET method. Additionally, JavaScript provides the
URLSearchParams.getAll(<name>) method, which returns an array of values
for a given parameter <name>.
Wouldn't it be more logical for request:parameter-map to also return an
array in such cases?
I’ve tested this issue with BaseX 12 on Windows, using the following
RESTXQ function:
declare
%rest:GET
%rest:path("test")
%output:method("json")
function page:test() {
request:parameter-map()
};
Any insights are appreciated.
Regards,
Tom De Herdt