Hey BaseX Team,
Im trying to serialize some JSON in order to make a few calls to an external api. In the json I need to include 'html' for example:
{
"subject": "Test Subject",
"content": {
type: "text/html",
text: "<div><h2>Issue:</h2></div>
},
"type": "document"
}
When I call the following script however I get:
{
"subject": "Test Subject 10",
"content": {
"type": "text\/html",
"text": "<html>\n <div>\n <h2>Issue:<\/h2>\n <\/div>\n<\/html>"
},
"type": "document"
}
I tried messing with the serialization parameters however with no success. I use the resulting string as the content for a http post request. Any help would be appreciated.
Script:
let $htmlContent := <div><h2>Issue:</h2></div>
return json:serialize(
<json objects="json">
<subject>Test Subject 10</subject>
<content type="object">
<type>text/html</type>
<text>{fn:serialize(<html>{ $someItem }</html>)}</text>
</content>
<type>document</type>
</json> )
Thanks,
James