Welcome to my site. I started this site as an online archive for me and all things virtual. I kept getting requests for help around some of the more standard issues we all hit in dealing with Cloud automation, particularly around the VMware vCloud Stack so I decided to make my forum public...and here we are.

My name is Lee Friend and I'm based in London, UK. I am a Cloud orchestration specialist in the end to end management, automation and integration of virtualisation stacks covering all pieces of the puzzle from IPAM (InfoBlox / QIP / IP Control), DNS, AD, resiliency & DR (SRM automation), management system integration (including ServiceNow, BMC Remedy, ticketing systems) and on and on.

Having worked since the very early days of virtualisation, I specialise in the vRealize suite (vRO,vRA,vCD,vR OPs,vCloudClient,SRM,and on) with the aim of orchestrating wherever it's needed. I have helped out large financials, global exchanges and cloud service providers at an architecture level all the way through to workflow engineering.

Using JSON in vRO

All topics related to VMware vCenter Orchestrator / vRealize Orchestrator
leefriend
Site Admin
Posts: 30
Joined: Sat Dec 20, 2014 4:45 pm

Using JSON in vRO

Postby leefriend » Wed Oct 12, 2016 10:32 am

JSON is lightweight, simple and quick and can fit well in some use cases in vRO for storing all sorts of information.

I find it quickest to use one of the many online JSON editors (www.jsoneditoronline.org). These validate the format so we know we have a valid file.

Code: Select all

{
    "builds": {
        "windows2008R2_standard": {
            "memorySize": 8,
            "cpuCount": 2,
            "etc etc etc": ....
        },
        "windows2008R2_large": {
            "memorySize": 16,
            "cpuCount": 4,
            "etc etc etc": ....           
        }
    }
}


We can use the file as is or we can add to vRO as a Resource Element. The latter means we can simply reference the file without having to use local disk access. Either way works fine.

This example uses the file as a resource element which has been added to my workflow as an attribute. To get the data we first need to parse the file at the section we want, then we can read the individual lines.

[input resource element => osSpecifications]

Code: Select all

var osSpecs  = JSON.parse(osSpecifications.getContentAsMimeAttachment().content);
var osProperties = osSpecs.builds["windows2008R2_standard"];
var cpu = osProperties.cpuCount;


Happy days :-)

Return to “Everything vCO / vRO”



cron