Hello everyone,
First, I want to say that I really like the JSON improvements in BaseX 8.0. Great job.
I am however having an issue when posting JSON with markup in it. For example:
let $out := map { name: 'myView', markup: "<div name='value'>Some other stuff</div>" }
http:send-request(<http:request method="POST" />, uri, $out)
The issue is that the resulting JSON body being posted has the 'markup' property xml escaped. IE:
{ "name": "myView", "markup": "<div name='value'>Some other ..... " }
I had a similar issue with file:write but resolved that by using file:write-string.
I have tried calling json:serialize on $out manually as well as declaring the option output:method to 'json'. I even tried changing the request object by inserting a http:body. IE:
<http:request method="GET"> <http:body content-type="application/json"> {json:serialize($out)} </http> </http>
Lastly, I have tried declaring the cdata-section option: declare option output:cdata-section-elements 'http:body';
Still no go...
Is this not possible? One option would be to serialize the content using file:write and then call curl. This is a workaround I have used in the past however I was hoping I was behind that now with the latest improvements to XQuery 3.1. Maybe I need to send the http:request object as a map instead of an xml node?
Thanks again for your time on all of this. - James