Layer7 API Management

 View Only
Expand all | Collapse all

Extracting Specific Elements/Values from XML or JSON file

  • 1.  Extracting Specific Elements/Values from XML or JSON file

    Posted Jul 17, 2019 10:30 AM
    Hello,

    I have an XML document that was sent from Docusign that is poorly unstructured with repetitive element tags that I cannot change/edit.
    I am trying to parse or pull the value(s) of the element tags <TabLabel> and <TabValue> within each <TabStatus> section.
    However, since the elements are labeled the same but with different values - it complicates things.

    How am I able to pull the values from those elements? What are some efficient methods?

    Here is my XML:

    <?xml version="1.0" encoding="utf-8"?>
    <DocuSignEnvelopeInformation xmlns="http://www.docusign.net/API/3.0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <EnvelopeStatus>
    <RecipientStatuses>
    <RecipientStatus>
    <Type>Signer</Type>
    <Email>test@gmail.com</Email>
    <UserName>Test User</UserName>
    <RoutingOrder>1</RoutingOrder>
    <Sent>2019-07-16T13:00:00.897</Sent>
    <Delivered>2019-07-16T13:00:40.293</Delivered>
    <Signed>2019-07-16T13:03:32.953</Signed>
    <DeclineReason xsi:nil="true"/>
    <Status>Completed</Status>
    <RecipientIPAddress>96.77.74.205</RecipientIPAddress>
    <CustomFields/>
    <TabStatuses>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>663</XPosition>
    <YPosition>713</YPosition>
    <TabLabel>Vendor Name</TabLabel>
    <TabName/>
    <TabValue>Bikini Bottom Incorportation</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>642</XPosition>
    <YPosition>356</YPosition>
    <TabLabel>Vendor Name</TabLabel>
    <TabName/>
    <TabValue>Bikini Bottom Incorportation</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>113</XPosition>
    <YPosition>435</YPosition>
    <TabLabel>Company Name Printed</TabLabel>
    <TabName/>
    <TabValue>Test User</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>644</XPosition>
    <YPosition>440</YPosition>
    <TabLabel>Vendor Name Printed</TabLabel>
    <TabName/>
    <TabValue>Spongebob Squarepants</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Company</TabType>
    <Status>Signed</Status>
    <XPosition>117</XPosition>
    <YPosition>360</YPosition>
    <TabLabel>Company Name</TabLabel>
    <TabName>vendor name</TabName>
    <TabValue>Krabby Patty</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>663</XPosition>
    <YPosition>769</YPosition>
    <TabLabel>Vendor Address 1</TabLabel>
    <TabName/>
    <TabValue>123 Fish Way</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>667</XPosition>
    <YPosition>827</YPosition>
    <TabLabel>Vendor City</TabLabel>
    <TabName/>
    <TabValue>Los Angeles</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>665</XPosition>
    <YPosition>885</YPosition>
    <TabLabel>Vendor Zip</TabLabel>
    <TabName/>
    <TabValue>90801</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>ZIP5</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>665</XPosition>
    <YPosition>856</YPosition>
    <TabLabel>Vendor State</TabLabel>
    <TabName/>
    <TabValue>California</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>663</XPosition>
    <YPosition>744</YPosition>
    <TabLabel>DBA Name</TabLabel>
    <TabName/>
    <TabValue>Bikini Bottom</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>115</XPosition>
    <YPosition>517</YPosition>
    <TabLabel>Date Signed</TabLabel>
    <TabName/>
    <TabValue>16/7/2019</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>667</XPosition>
    <YPosition>971</YPosition>
    <TabLabel>Vendor Country</TabLabel>
    <TabName/>
    <TabValue>United States</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>665</XPosition>
    <YPosition>940</YPosition>
    <TabLabel>Fax</TabLabel>
    <TabName/>
    <TabValue>404000111</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Number</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>665</XPosition>
    <YPosition>913</YPosition>
    <TabLabel>Vendor Phone</TabLabel>
    <TabName/>
    <TabValue>1234567890</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Number</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>667</XPosition>
    <YPosition>1083</YPosition>
    <TabLabel>Vendor First Name</TabLabel>
    <TabName/>
    <TabValue>Eugene</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>667</XPosition>
    <YPosition>1196</YPosition>
    <TabLabel>Admin Mobile</TabLabel>
    <TabName/>
    <TabValue>4049351111</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Number</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>665</XPosition>
    <YPosition>1169</YPosition>
    <TabLabel>Admin Email</TabLabel>
    <TabName/>
    <TabValue>ekrabs@gmail.com</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Email</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>667</XPosition>
    <YPosition>1056</YPosition>
    <TabLabel>MSA Indicator</TabLabel>
    <TabName/>
    <TabValue>Yes</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>665</XPosition>
    <YPosition>1138</YPosition>
    <TabLabel>Vendor Last Name</TabLabel>
    <TabName/>
    <TabValue>Krabs</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>667</XPosition>
    <YPosition>1027</YPosition>
    <TabLabel>MSA Expiration Date</TabLabel>
    <TabName/>
    <TabValue>12/31/2019</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Date</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>665</XPosition>
    <YPosition>998</YPosition>
    <TabLabel>EIN</TabLabel>
    <TabName/>
    <TabValue>091234567</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>667</XPosition>
    <YPosition>1252</YPosition>
    <TabLabel>Sponsor Email</TabLabel>
    <TabName/>
    <TabValue>bbottom@msn.com</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Email</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Signed</Status>
    <XPosition>667</XPosition>
    <YPosition>1223</YPosition>
    <TabLabel>Admin Work Phone</TabLabel>
    <TabName/>
    <TabValue>4049352222</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Number</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>DateSigned</TabType>
    <Status>Signed</Status>
    <XPosition>644</XPosition>
    <YPosition>519</YPosition>
    <TabLabel>Date Signed</TabLabel>
    <TabName>DateSigned</TabName>
    <TabValue>16/7/2019</TabValue>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Active</Status>
    <XPosition>665</XPosition>
    <YPosition>802</YPosition>
    <TabLabel>Vendor Address 2</TabLabel>
    <TabName/>
    <TabValue/>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    <TabStatus>
    <TabType>Custom</TabType>
    <Status>Active</Status>
    <XPosition>665</XPosition>
    <YPosition>1113</YPosition>
    <TabLabel>Admin Preferred Name</TabLabel>
    <TabName/>
    <TabValue/>
    <DocumentID>1</DocumentID>
    <PageNumber>1</PageNumber>
    <ValidationPattern/>
    <CustomTabType>Text</CustomTabType>
    </TabStatus>
    </TabStatuses>
    <RecipientAttachment>
    <Attachment>
    <Data>PEZvcm1EYXRhPjx4ZmRmPjxmaWVsZHM+PGZpZWxkIG5hbWU9IlZlbmRvciBOYW1lIj48dmFsdWU+QmlraW5pIEJvdHRvbSBJbmNvcnBvcnRhdGlvbjwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iRGF0ZVNpZ25lZCI+PHZhbHVlPjE2LzcvMjAxOTwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iQWRtaW4gV29yayBQaG9uZSI+PHZhbHVlPjQwNDkzNTIyMjI8L3ZhbHVlPjwvZmllbGQ+PGZpZWxkIG5hbWU9IlNwb25zb3IgRW1haWwiPjx2YWx1ZT5iYm90dG9tQG1zbi5jb208L3ZhbHVlPjwvZmllbGQ+PGZpZWxkIG5hbWU9IkVJTiI+PHZhbHVlPjA5MTIzNDU2NzwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iTVNBIEV4cGlyYXRpb24gRGF0ZSI+PHZhbHVlPjEyLzMxLzIwMTk8L3ZhbHVlPjwvZmllbGQ+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HJlc3MgMSI+PHZhbHVlPjEyMyBGaXNoIFdheTwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iQ29tcGFueSI+PHZhbHVlPktyYWJieSBQYXR0eTwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iVmVuZG9yIE5hbWUgUHJpbnRlZCI+PHZhbHVlPlNwb25nZWJvYiBTcXVhcmVwYW50czwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iQ29tcGFueSBOYW1lIFByaW50ZWQiPjx2YWx1ZT5UaWZmYW55IEtvbmdwYWNoaXRoPC92YWx1ZT48L2ZpZWxkPjxmaWVsZCBuYW1lPSJWZW5kb3IgTmFtZV8xIj48dmFsdWU+QmlraW5pIEJvdHRvbSBJbmNvcnBvcnRhdGlvbjwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iVmVuZG9yIEFkZHJlc3MgMiI+PHZhbHVlPjwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iQWRtaW4gUHJlZmVycmVkIE5hbWUiPjx2YWx1ZT48L3ZhbHVlPjwvZmllbGQ+PC9maWVsZHM+PC94ZmRmPjwvRm9ybURhdGE+</Data>
    <Label>DSXForm</Label>
    </Attachment>
    </RecipientAttachment>
    <AccountStatus>Active</AccountStatus>
    <FormData>
    <xfdf>
    <fields>
    <field name="Vendor Name">
    <value>Bikini Bottom Incorportation</value>
    </field>
    <field name="DateSigned">
    <value>16/7/2019</value>
    </field>
    <field name="Admin Work Phone">
    <value>4049352222</value>
    </field>
    <field name="Sponsor Email">
    <value>bbottom@msn.com</value>
    </field>
    <field name="EIN">
    <value>091234567</value>
    </field>
    <field name="MSA Expiration Date">
    <value>12/31/2019</value>
    </field>
    <field name="Vendor Last Name">
    <value>Krabs</value>
    </field>
    <field name="MSA Indicator">
    <value>Yes</value>
    </field>
    <field name="Admin Email">
    <value>ekrabs@gmail.com</value>
    </field>
    <field name="Admin Mobile">
    <value>4049351111</value>
    </field>
    <field name="Vendor First Name">
    <value>Eugene</value>
    </field>
    <field name="Vendor Phone">
    <value>1234567890</value>
    </field>
    <field name="Fax">
    <value>404000111</value>
    </field>
    <field name="Vendor Country">
    <value>United States</value>
    </field>
    <field name="Date Signed">
    <value>16/7/2019</value>
    </field>
    <field name="DBA Name">
    <value>Bikini Bottom</value>
    </field>
    <field name="Vendor State">
    <value>California</value>
    </field>
    <field name="Vendor Zip">
    <value>90801</value>
    </field>
    <field name="Vendor City">
    <value>Los Angeles</value>
    </field>
    <field name="Vendor Address 1">
    <value>123 Fish Way</value>
    </field>
    <field name="Company">
    <value>Krabby Patty</value>
    </field>
    <field name="Vendor Name Printed">
    <value>Spongebob Squarepants</value>
    </field>
    <field name="Company Name Printed">
    <value>Test User</value>
    </field>
    <field name="Vendor Name_1">
    <value>Bikini Bottom Incorportation</value>
    </field>
    <field name="Vendor Address 2">
    <value/>
    </field>
    <field name="Admin Preferred Name">
    <value/>
    </field>
    </fields>
    </xfdf>
    </FormData>
    <RecipientId>052c6bb2-2375-4176-934b-416ec56b9b04</RecipientId>
    </RecipientStatus>
    </RecipientStatuses>
    <TimeGenerated>2019-07-16T13:03:53.2790524</TimeGenerated>
    <EnvelopeID>1642810e-c786-488b-964a-b70060d4e8d9</EnvelopeID>
    <Subject>Please DocuSign: Sample Letter of Agreement.doc</Subject>
    <UserName>XYZ</UserName>
    <Email>test@gmail.com</Email>
    <Status>Completed</Status>
    <Created>2019-07-16T12:59:46.857</Created>
    <Sent>2019-07-16T13:00:00.927</Sent>
    <Delivered>2019-07-16T13:00:40.373</Delivered>
    <Signed>2019-07-16T13:03:32.953</Signed>
    <Completed>2019-07-16T13:03:32.953</Completed>
    <ACStatus>Original</ACStatus>
    <ACStatusDate>2019-07-16T12:59:46.857</ACStatusDate>
    <ACHolder>Test User</ACHolder>
    <ACHolderEmail>test@gmail.com</ACHolderEmail>
    <ACHolderLocation>DocuSign</ACHolderLocation>
    <SigningLocation>Online</SigningLocation>
    <SenderIPAddress>XX.XX.XX.XXX </SenderIPAddress>
    <EnvelopePDFHash/>
    <CustomFields>
    <CustomField>
    <Name>Custom Field</Name>
    <Show>False</Show>
    <Required>False</Required>
    <Value/>
    </CustomField>
    <CustomField>
    <Name>templateUsageRestriction</Name>
    <Show>False</Show>
    <Required>False</Required>
    <Value>allOptions</Value>
    </CustomField>
    </CustomFields>
    <AutoNavigation>true</AutoNavigation>
    <EnvelopeIdStamping>true</EnvelopeIdStamping>
    <AuthoritativeCopy>false</AuthoritativeCopy>
    <DocumentStatuses>
    <DocumentStatus>
    <ID>1</ID>
    <Name>Sample Letter of Agreement.doc</Name>
    <TemplateName>BikiniBottom</TemplateName>
    <Sequence>1</Sequence>
    </DocumentStatus>
    </DocumentStatuses>
    </EnvelopeStatus>
    </DocuSignEnvelopeInformation>

    I have also transformed the XML to JSON formatting.

    Here is the JSON format:
    {"DocuSignEnvelopeInformation": {
    "xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
    "xmlns": "http://www.docusign.net/API/3.0",
    "EnvelopeStatus": {
    "Email": "test@gmail.com",
    "AuthoritativeCopy": false,
    "ACHolderLocation": "DocuSign",
    "ACStatusDate": "2019-07-16T12:59:46.857",
    "SigningLocation": "Online",
    "RecipientStatuses": {"RecipientStatus": {
    "Status": "Completed",
    "FormData": {"xfdf": {"fields": {"field": [
    {
    "name": "Vendor Name",
    "value": "Bikini Bottom Incorportation"
    },
    {
    "name": "Admin Work Phone",
    "value": "4049352222"
    },
    {
    "name": "Sponsor Email",
    "value": "bbottom@msn.com"
    },
    {
    "name": "EIN",
    "value": "091234567"
    },
    {
    "name": "MSA Expiration Date",
    "value": "12/31/2019"
    },
    {
    "name": "Vendor Last Name",
    "value": "Krabs"
    },
    {
    "name": "MSA Indicator",
    "value": "Yes"
    },
    {
    "name": "Admin Email",
    "value": "ekrabs@gmail.com"
    },
    {
    "name": "Admin Mobile",
    "value": "4049351111"
    },
    {
    "name": "Vendor First Name",
    "value": "Eugene"
    },
    {
    "name": "Vendor Phone",
    "value": "1234567890"
    },
    {
    "name": "Fax",
    "value": "404000111"
    },
    {
    "name": "Vendor Country",
    "value": "United States"
    },
    {
    "name": "Date Signed",
    "value": "16/7/2019"
    },
    {
    "name": "DBA Name",
    "value": "Bikini Bottom"
    },
    {
    "name": "Vendor State",
    "value": "California"
    },
    {
    "name": "Vendor Zip",
    "value": "90801"
    },
    {
    "name": "Vendor City",
    "value": "Los Angeles"
    },
    {
    "name": "Vendor Address 1",
    "value": "123 Fish Way"
    },
    {
    "name": "Company",
    "value": "Krabby Patty"
    },
    {
    "name": "Vendor Name Printed",
    "value": "Spongebob Squarepants"
    },
    {
    "name": "Company Name Printed",
    "value": "Test User"
    },
    {
    "name": "Vendor Name_1",
    "value": "Bikini Bottom Incorportation"
    },
    {
    "name": "Vendor Address 2",
    "value": ""
    },
    {
    "name": "Admin Preferred Name",
    "value": ""
    }
    ]}}},
    "Email": "test@gmail.com",
    "UserName": "Test User",
    "RecipientId": "052c6bb2-2375-4176-934b-416ec56b9b04",
    "Delivered": "2019-07-16T13:00:40.293",
    "Signed": "2019-07-16T13:03:32.953",
    "TabStatuses": {"TabStatus": [
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "663",
    "YPosition": "713",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Vendor Name",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "Bikini Bottom Incorportation"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "642",
    "YPosition": "356",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Vendor Name",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "Bikini Bottom Incorportation"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "113",
    "YPosition": "435",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Company Name Printed",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "Test User"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "644",
    "YPosition": "440",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Vendor Name Printed",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "Spongebob Squarepants"
    },
    {
    "Status": "Signed",
    "TabType": "Company",
    "XPosition": "117",
    "YPosition": "360",
    "PageNumber": "1",
    "DocumentID": "1",
    "TabLabel": "Company Name",
    "TabName": "vendor name",
    "TabValue": "Krabby Patty"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "663",
    "YPosition": "769",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Vendor Address 1",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "123 Fish Way"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "667",
    "YPosition": "827",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Vendor City",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "Los Angeles"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "665",
    "YPosition": "885",
    "PageNumber": "1",
    "CustomTabType": "ZIP5",
    "DocumentID": "1",
    "TabLabel": "Vendor Zip",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "90801"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "665",
    "YPosition": "856",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Vendor State",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "California"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "663",
    "YPosition": "744",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "DBA Name",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "Bikini Bottom"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "115",
    "YPosition": "517",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Date Signed",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "16/7/2019"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "667",
    "YPosition": "971",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Vendor Country",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "United States"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "665",
    "YPosition": "940",
    "PageNumber": "1",
    "CustomTabType": "Number",
    "DocumentID": "1",
    "TabLabel": "Fax",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "404000111"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "665",
    "YPosition": "913",
    "PageNumber": "1",
    "CustomTabType": "Number",
    "DocumentID": "1",
    "TabLabel": "Vendor Phone",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "1234567890"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "667",
    "YPosition": "1083",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Vendor First Name",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "Eugene"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "667",
    "YPosition": "1196",
    "PageNumber": "1",
    "CustomTabType": "Number",
    "DocumentID": "1",
    "TabLabel": "Admin Mobile",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "4049351111"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "665",
    "YPosition": "1169",
    "PageNumber": "1",
    "CustomTabType": "Email",
    "DocumentID": "1",
    "TabLabel": "Admin Email",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "ekrabs@gmail.com"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "667",
    "YPosition": "1056",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "MSA Indicator",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "Yes"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "665",
    "YPosition": "1138",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Vendor Last Name",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "Krabs"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "667",
    "YPosition": "1027",
    "PageNumber": "1",
    "CustomTabType": "Date",
    "DocumentID": "1",
    "TabLabel": "MSA Expiration Date",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "12/31/2019"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "665",
    "YPosition": "998",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "EIN",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "091234567"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "667",
    "YPosition": "1252",
    "PageNumber": "1",
    "CustomTabType": "Email",
    "DocumentID": "1",
    "TabLabel": "Sponsor Email",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "bbottom@msn.com"
    },
    {
    "Status": "Signed",
    "TabType": "Custom",
    "XPosition": "667",
    "YPosition": "1223",
    "PageNumber": "1",
    "CustomTabType": "Number",
    "DocumentID": "1",
    "TabLabel": "Admin Work Phone",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": "4049352222"
    },
    {
    "Status": "Signed",
    "TabType": "DateSigned",
    "XPosition": "644",
    "YPosition": "519",
    "PageNumber": "1",
    "DocumentID": "1",
    "TabLabel": "Date Signed",
    "TabName": "DateSigned",
    "TabValue": "16/7/2019"
    },
    {
    "Status": "Active",
    "TabType": "Custom",
    "XPosition": "665",
    "YPosition": "802",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Vendor Address 2",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": ""
    },
    {
    "Status": "Active",
    "TabType": "Custom",
    "XPosition": "665",
    "YPosition": "1113",
    "PageNumber": "1",
    "CustomTabType": "Text",
    "DocumentID": "1",
    "TabLabel": "Admin Preferred Name",
    "TabName": "",
    "ValidationPattern": "",
    "TabValue": ""
    }
    ]},
    "RecipientAttachment": {"Attachment": {
    "Label": "DSXForm",
    "Data": "PEZvcm1EYXRhPjx4ZmRmPjxmaWVsZHM+PGZpZWxkIG5hbWU9IlZlbmRvciBOYW1lIj48dmFsdWU+QmlraW5pIEJvdHRvbSBJbmNvcnBvcnRhdGlvbjwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iRGF0ZVNpZ25lZCI+PHZhbHVlPjE2LzcvMjAxOTwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iQWRtaW4gV29yayBQaG9uZSI+PHZhbHVlPjQwNDkzNTIyMjI8L3ZhbHVlPjwvZmllbGQ+PGZpZWxkIG5hbWU9IlNwb25zb3IgRW1haWwiPjx2YWx1ZT5iYm90dG9tQG1zbi5jb208L3ZhbHVlPjwvZmllbGQ+PGZpZWxkIG5hbWU9IkVJTiI+PHZhbHVlPjA5MTIzNDU2NzwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iTVNBIEV4cGlyYXRpb24gRGF0ZSI+PHZhbHVlPjEyLzMxLzIwMTk8L3ZhbHVlPjwvZmllbGQ+PGZpZWxkIG5hbWU9IlZlbmRvciBMYXN0IE5hbWUiPjx2YWx1ZT5LcmFiczwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iTVNBIEluZGljYXRvciI+PHZhbHVlPlllczwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iQWRtaW4gRW1haWwiPjx2YWx1ZT5la3JhYnNAZ21haWwuY29tPC92YWx1ZT48L2ZpZWxkPjxmaWVsZCBuYW1lPSJBZG1pbiBNb2JpbGUiPj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W50ZWQiPjx2YWx1ZT5UaWZmYW55IEtvbmdwYWNoaXRoPC92YWx1ZT48L2ZpZWxkPjxmaWVsZCBuYW1lPSJWZW5kb3IgTmFtZV8xIj48dmFsdWU+QmlraW5pIEJvdHRvbSBJbmNvcnBvcnRhdGlvbjwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iVmVuZG9yIEFkZHJlc3MgMiI+PHZhbHVlPjwvdmFsdWU+PC9maWVsZD48ZmllbGQgbmFtZT0iQWRtaW4gUHJlZmVycmVkIE5hbWUiPjx2YWx1ZT48L3ZhbHVlPjwvZmllbGQ+PC9maWVsZHM+PC94ZmRmPjwvRm9ybURhdGE+"
    }},
    "AccountStatus": "Active",
    "Type": "Signer",
    "CustomFields": "",
    "RecipientIPAddress": "96.77.74.205",
    "RoutingOrder": "1",
    "DeclineReason": {"xsi:nil": true},
    "Sent": "2019-07-16T13:00:00.897"
    }},
    "Created": "2019-07-16T12:59:46.857",
    "ACHolderEmail": "test@gmail.com",
    "DocumentStatuses": {"DocumentStatus": {
    "TemplateName": "BikiniBottom",
    "ID": "1",
    "Sequence": "1",
    "Name": "Sample Letter of Agreement.doc"
    }},
    "ACStatus": "Original",
    "Sent": "2019-07-16T13:00:00.927",
    "Status": "Completed",
    "EnvelopeIdStamping": true,
    "TimeGenerated": "2019-07-16T13:03:53.2790524",
    "UserName": "Test User",
    "EnvelopeID": "1642810e-c786-488b-964a-b70060d4e8d9",
    "Delivered": "2019-07-16T13:00:40.373",
    "Signed": "2019-07-16T13:03:32.953",
    "Subject": "Please DocuSign: Sample Letter of Agreement.doc",
    "SenderIPAddress": "96.77.74.205",
    "EnvelopePDFHash": "",
    "AutoNavigation": true,
    "CustomFields": {"CustomField": [
    {
    "Required": false,
    "Value": "",
    "Show": false,
    "Name": "Custom Field"
    },
    {
    "Required": false,
    "Value": "allOptions",
    "Show": false,
    "Name": "templateUsageRestriction"
    }
    ]},
    "ACHolder": "Test User",
    "Completed": "2019-07-16T13:03:32.953"
    },
    "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance"
    }}

    ///

    I want to be able to parse or format the data into a Key:Value pairs that is easy for me to extract JUST the value itself.
    Because as of right now it is:
    {
      "name": "Vendor Name"
      "value": "Bikini Bottom Incorporation"
    }

    The goal is for it to look in JSON format:
    {
      "Vendor Name": "Bikini Bottom Incorporation"
    }

    OR how do I parse this kind of JSON so that it can create 3 separate context variables in the API Gateway such as Vendor Name, Vendor Phone, Vendor... etc with the values? Are there certain context variable expressions to pull the values or individually?

    ///

    In XML it is currently:
    <TabLabel>Vendor Name</TabLabel>
    <TabValue>Bikini Bottom Incorporation</TabValue>
    OR
    <fields>
    <field name="Vendor Name">
    <value>Bikini Bottom Incorporation</value>
    </field>

    How can I take that example above and with whole XML to look like or be formatted like this,
    <Vendor>
    <VendorName>Bikini Bottom Incorporation</VendorName>??
    </Vendor>

    Please let me know what anyone's thoughts are to this obstacle and its possible solutions.
    Thanks!


  • 2.  RE: Extracting Specific Elements/Values from XML or JSON file
    Best Answer

    Posted Jul 17, 2019 11:40 AM
    You can use evaluate response  Xpath assertion to read the specific values of xml. Where you can define conditions to match also. put  the extracted data into a context variable. define your template of xml where you want to put the data use context variable data out here to set values dynamically.

    For JSON to read use Apply JSON path expression. It brings you required data. follow above methodology to do for json also.