17 Jan
2015
17 Jan
'15
8:43 a.m.
I'd like to be able to generate pure JSON from a wiki page, to use in other pages via AJAX. To that end I created a page with the following content: {{velocity wiki="false"}} $response.setContentType('application/json') { "greeting" : "Hello", "location": "World" } {{/velocity}} Calling this via /xwiki/bin/get/Sandbox/JsonTest I get the following code: <p><br/>{<br/>"greeting" : "Hello",<br/>"location": "World"<br/>}</p> I get the same via /xwiki/bin/view/AlertDB/JsonTest?xpage=plain. If I remove the $response.setContentType('application/json') https://dev.alertnessdb.net/xwiki/bin/view/AlertDB/JsonTest?xpage=plain