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 (as reported by
FireBug):
<p><br/>{<br/>"greeting" :
"Hello",<br/>"location":
"World"<br/>}</p>
I get the same via /xwiki/bin/view/AlertDB/JsonTest?xpage=plain (as suggested in
http://jira.xwiki.org/browse/XWIKI-3413). Is there a way to produce pure JSON by a
velocity script by some variation of my approach?