Thanks so much for that. It did indeed work :-) So 'view' with xpage=plain&outputSyntax=plain or just 'get' with outputSyntax=plain does the job.
Now I know what to look for, for posterity I've put this information into http://extensions.xwiki.org/xwiki/bin/view/Extension/Output+JSON FWIW I'd have rather put the license as something like "public domain", but the closest ("Do What The F*** You Want..") seemed unnecessarily vulgar. Does such language really have a place on your website? Thanks, Bryn ________________________________ From: Vincent Massol [vmas...@gmail.com] on behalf of vinc...@massol.net [vinc...@massol.net] Sent: 17 January 2015 21:23 To: XWiki Users Cc: Bryn Jeffries Subject: Re: [xwiki-users] Generating pure JSON Hi Bryn, On 17 Jan 2015 at 09:43:30, Bryn Jeffries (bryn.jeffr...@sydney.edu.au(mailto:bryn.jeffr...@sydney.edu.au)) wrote: > 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: > > { "greeting" : "Hello", "location": "World" } > > 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 Inded, I would have imagine also that xpage=plain would have worked but it doesn’t. You have to use outputsyntax. For example: http://playground.xwiki.org/xwiki/bin/get/Main/VMA?outputSyntax=plain Note: You can go on a page with a livetable and check with Chrome dev tools or Firebug the requests done and you’ll see it uses that. Thanks -Vincent _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users