Hi Stéphane, MarkLogic won’t convert content. You could try applying a REST transform on your search results, and use something like json:transform-to-json (probably with the custom config) to convert those on the fly..
You could also convert client-side of course.. Cheers, Geert From: <[email protected]<mailto:[email protected]>> on behalf of "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Thursday, June 23, 2016 at 11:19 AM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: [MarkLogic Dev General] format:json && extract-document-data Hi, I am trying to include some document data into my search results, using the following query options: <options xmlns="http://marklogic.com/appservices/search"> <extract-document-data selected="include"> <extract-path>/language-version/ language-version-canonical-model/title</extract-path> <extract-path>/language-version/ language-version-canonical-model/language</extract-path> (…) </extract-document-data> </options> Unfortunately, when I ask for json format (using header Accpet: application/json), the extracted element comes as “stringyfied” xml instead of being converted into json as I would have expected: { "snippet-format": "snippet", "total": 564, "start": 1, "page-length": 10, "selected": "include", "results": [ { "index": 1, "uri": "ENV/CHEM/NANO(2015)22/ANN5/2", "path": "fn:doc(\"ENV/CHEM/NANO(2015)22/ANN5/2\")", (…) "extracted": { "kind": "element", "content": [ "<language>En</language>", "<title>ZINC OXIDE DOSSIERANNEX 5</title>", "<reference>ENV/CHEM/NANO(2015)22/ANN5</reference>", "<classification>2</classification>", "<modificationDate>2015-04-16T00:00:00.000+02:00</modificationDate>", "<subject label_en=\"media\">media</subject>", "<subject label_en=\"fish\">fish</subject>", (…) ] } }, Anything I am doing wrong? Is there some configuration options I could tweak to enforce the conversion of xml to json? Cheers, Stéphane Varin
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
