Thanks for the quick response. I had looked at the VelocityTools page several 
times before posting. Unfortunately it wasn't very useful to me as a beginner 
as there weren't any examples of how to use it (and I couldn't deduce the 
syntax and requirements from looking at the source of the tools).

Anyway, this page may have a groovy example that might work for me. I just 
haven't had the time to test it today (and it seems the need to read the JSON 
may now been cancelled anyway) -

Thanks again for the help.

Kind regards,

Mahomed Hussein
Custodian Data Centre

-----Original Message-----
From: users [] On Behalf Of Vincent Massol
Sent: 19 April 2016 18:38
To: XWiki Users <>
Subject: Re: [xwiki-users] Parsing external JSON with Velocity in XWiki

> On 19 Apr 2016, at 19:18, Mahomed Hussein <> wrote:
> Hi
> I started off on something I thought would be simple, but my limited 
> knowledge is failing me and Google isn’t bringing up anything useful.
> Basically, I have a url that returns JSON content (for the sake of this 
> example – assume the url is
> The content returned by the URL is:
> {"page":{"id":"9jyl5nk7mszv","name":"Custodian 
> DataCentres","url":"","updated_at":"2016-04-19T15:45:36.626+01:00"},"status":{"indicator":"none","description":"All
>  Systems Operational"}}
> What I wanted to do was to simply read that JSON and then process the values 
> and possibly output something like:
> Status: All Systems Operational
> Last Update: 2016-04-19T15:45:36
> So far I have managed to get the URL content with:
> {{velocity}}
> #set($jsoncontent = 
> $xwiki.getURLContent(‘’))
> $jsoncontent
> {{/velocity}}
> This is where I get stuck. How do I get the $jsonconent into an array or 
> somehow read the values?

There’s a $jsontool you can use in velocity, see

Otherwise you can also use groovy instead which supports reading and parsing 
JSON by default. Several examples are on


> Apologies for the basic question, but I hope someone can either point me in 
> the right direction or provide an example I can work from. Thanks.
> Kind regards,
> Mahomed Hussein
> Custodian Data Centre
users mailing list
users mailing list

Reply via email to