Hi James,
by default, all string results are XML-encoded. You’ll get the expected result by declaring "text" as output option in the prolog (header) of your query:
declare option output:method 'text'; let $someItem := ...
Our Wiki page on serialization may give you more hints [1].
Hope this helps, Christian
[1] http://docs.basex.org/wiki/Serialization ___________________________
2013/8/2 James Wright james.jw@hotmail.com:
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
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk