Hi Andreas,
Thanks for your observations. A new snapshot is available, containing the fix for the copy expression [1]; an updated version for inspect:type will follow soon (this bug is only due to the generatation of the output for the InfoView panel).
With regard to your third question: In a previous 11.x version of BaseX, the behavior of http:send-request was changed, making th explicite json:serialize call obsolete (it should have been better documented).
Here’s one way to send XML JSON representations to the server with the current version:
(: Query :)
http:send-request(
<http:request method='post'><http:body media-type='application/json'/></http:request>,
'http://localhost...',
<json>a</json>
)
(: RESTXQ endpoint :)
declare %rest:path('test') %rest:POST('{$x}') function local:f($x) { };
Best,
Christian
Von: Andreas Hengsbach <andreas.hengsbach@nexoma.de>
Gesendet: Dienstag, 8. Juli 2025 14:52
An: basex-talk@mailman.uni-konstanz.de <basex-talk@mailman.uni-konstanz.de>
Betreff: [basex-talk] Re: Problem (BaseX 12) serializing a map with json:serialize() in combination with the http-client module
Hello, it's me again.
I can't actually find a way to transport a JSON as a request body except with a map, which obviously always has a json representation as well.
My current workaround for my code base is to convert the serialized form back into a map using xquery:eval.
let $requestBody := element { 'json' } {
attribute { 'type' } { 'object' },
element { 'the' } {
attribute { 'type' } { 'object' },
element { 'shit' } {
attribute { 'type' } { 'object' },
element { 'is' } {
attribute { 'type' } { 'array' },
element { '_' } {
attribute { 'type' } { 'object' },
element { 'on' } {
attribute { 'type' } { 'object' },
element { 'the' } {
"steam"
}
}
},
element { '_' } {
attribute { 'type' } { 'object' },
element { 'what' } {
attribute { 'type' } { 'object' },
element { 'the' } {
"f..."
}
}
}
}
}
}
}
return $requestBody => json:serialize() => xquery:eval()