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
https://status.com/api/status.json)
The content returned by the URL is:
{"page":{"id":"9jyl5nk7mszv","name":"Custodian
DataCentres","url":"http://status.custdc.net","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(‘https://status.com/api/status.json’))
$jsoncontent
{{/velocity}}
This is where I get stuck. How do I get the $jsonconent into an array or somehow read the
values?
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
Email: Mahomed(a)CustodianDC.com
http://www.CustodianDC.com