XML to JSON

  • 21 March 2019
  • 1 reply
  • 7 views

Badge +3

Hi,

 

I'm currently using the 2013 Query XML action to extract information from the following example XML using xpath. I would like to do this in NWC and am after suggestions on the best way to achieve this. Converting the XML to JSON via an online converter (http://www.vadimtabakman.com/xml-to-json-converter.aspx) and using the Query JSON action in NWC does exactly what I need, however I'm unsure how to programatically perform the conversion as part of the workflow. Any suggestions?  

 

<?xml version="1.0" encoding="UTF-8"?>
<ws:Worker_Sync xmlns:ws="urn:com.workday/workersync" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ws:Header>
<ws:Version>25.0</ws:Version>
<ws:Prior_Entry_Time>2019-03-19T20:00:17.694-07:00</ws:Prior_Entry_Time>
<ws:Current_Entry_Time>2019-03-20T08:00:17.692-07:00</ws:Current_Entry_Time>
<ws:Prior_Effective_Time>2019-04-02T00:00:00.000-07:00</ws:Prior_Effective_Time>
<ws:Current_Effective_Time>2019-04-03T00:00:00.000-07:00</ws:Current_Effective_Time>
<ws:Full_File>false</ws:Full_File>
<ws:Document_Retention_Policy>30</ws:Document_Retention_Policy>
<ws:Worker_Count>1</ws:Worker_Count>
</ws:Header>
<ws:Worker>
<ws:Summary>
<ws:Employee_ID>12345678</ws:Employee_ID>
<ws:Name>Joe Bloggs</ws:Name>
</ws:Summary>
<ws:Eligibility>true</ws:Eligibility>
<ws:Personal>
<ws:Name_Data>
<ws:Name_Type>Legal</ws:Name_Type>
<ws:First_Name>Joe</ws:First_Name>
<ws:Last_Name>Bloggs</ws:Last_Name>
</ws:Name_Data>
<ws:Name_Data>
<ws:Name_Type>Preferred</ws:Name_Type>
<ws:First_Name>Joe</ws:First_Name>
<ws:Last_Name>Bloggs</ws:Last_Name>
</ws:Name_Data>
<ws:Address_Data>
<ws:Address_Line_Data ws:Label="Address Line 1" ws:Type="ADDRESS_LINE_1">Test Office Address1</ws:Address_Line_Data>
<ws:Address_Line_Data ws:Label="Address Line 2" ws:Type="ADDRESS_LINE_2">Test Office Address2</ws:Address_Line_Data>
<ws:Municipality>London</ws:Municipality>
<ws:Country>UK</ws:Country>
</ws:Address_Data>
<ws:Email_Data>
<ws:Is_Primary>true</ws:Is_Primary>
<ws:Email_Address>joe.bloggs@testcompany.com</ws:Email_Address>
</ws:Email_Data>
</ws:Personal>
<ws:Status>
<ws:Employee_Status>Active</ws:Employee_Status>
<ws:Hire_Date>2019-03-21</ws:Hire_Date>
<ws:Original_Hire_Date ws:PriorValue="2018-05-07">2019-03-21</ws:Original_Hire_Date>
</ws:Status>
<ws:Position>
<ws:Operation>NONE</ws:Operation>
<ws:Primary_Position>true</ws:Primary_Position>
<ws:Business_Title>Developer</ws:Business_Title>
<ws:Organization_Data>
<ws:Operation>NONE</ws:Operation>
<ws:Organization>TestOrg</ws:Organization>
<ws:Organization_Type>Function</ws:Organization_Type>
</ws:Organization_Data>
<ws:Business_Site>12345</ws:Business_Site>
<ws:Supervisor>
<ws:Operation>NONE</ws:Operation>
<ws:Supervisor_ID>87654321</ws:Supervisor_ID>
<ws:Supervisor_Name>Jane Doe</ws:Supervisor_Name>
</ws:Supervisor>
</ws:Position>
<ws:Additional_Information>
<ws:Manager_Email>jane.doe@testcompany.com</ws:Manager_Email>
<ws:Location_Country>United Kingdom</ws:Location_Country>
<ws:Cost_center>Test Company Cost Centre</ws:Cost_center>
<ws:Company_Name>Test Company</ws:Company_Name>
<ws:Supervisory_Name>DOE: Test Company (Jane Doe (12345678))</ws:Supervisory_Name>
</ws:Additional_Information>
</ws:Worker>

</ws:Worker_Sync>


1 reply

Badge +3

OK so I've found this which is useful but it would be good to get a query XML action in NWC. 

Reply