Avatar of Swadhin Ray
Swadhin Ray
Flag for United States of America asked on

Not able to parse in JSON

Hello Experts,

I have a JSON output coming from database. But while parsing I am not able to parse it.

I have the output attached here and the link :

JSON-OUTPUT.txt


http://jsfiddle.net/DYZR4/

Open in new window

JavaScriptjQueryJScript

Avatar of undefined
Last Comment
Swadhin Ray

8/22/2022 - Mon
khan_webguru

Hello,

I have tested your JSON and it's working fine even in the fiddle link that you have provided.
I reckon you might have getting error before parsing you JSON. Please have alook on below link

<link removed - GaryC123>

You can use JQuery as well.

If you want to validate your JSON to examine weather it's proper JSON format or not you can use following reference.

 http://jsonlint.com/

Regards,

khan.webguru
Swadhin Ray

ASKER
When I take that JSON and validate it ...

It shows me one today and one upcoming .

Where as if you see the json it has 8 nodes in total.

6 for today and 2 for upcoming
Swadhin Ray

ASKER
When I am trying to use :

var s = '{"metadata":{"USER_TY ......

:[{"ASSIGNMENTS":""}]}]}]}]}';


var data = JSON.parse(s);

alert(data.result);

Open in new window


I am getting "undefined" as result.

Also tried like below:

var s = '{"metadata":{"USER_TY ......

:[{"ASSIGNMENTS":""}]}]}]}]}';


var objJSON = eval("(function(){return " + s + ";})()");
alert(objJSON.result);
alert(objJSON.count);

Open in new window

Your help has saved me hundreds of hours of internet surfing.
fblack61
khan_webguru

You don't have any array on root level please try below

alert(data.TODAY.length);
alert(data.UPCOMING.length);

it's returning length= 1

Regards,
AK
ASKER CERTIFIED SOLUTION
khan_webguru

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
khan_webguru

And in your case if you really want to have length then use the following technique

alert(Object.keys(data).length);

Cheers,
khan.webguru
Swadhin Ray

ASKER
As it is returning 1 and 1 which is not correct.

As I have 6 records as today and 2 for upcoming ....

Is there a way I can group it before parsing it.  or may be parsing it. As under today I have 6 records .
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
khan_webguru

It depend on your JSON if you want to parse in such a style then apply some tweaks in your JSON so that should behave exactly in same way that you want.

Cheers,
khan.webguru
Swadhin Ray

ASKER
I have my XSLT as below:

<?xml version="1.0" encoding="ISO-8859-1"?>
     <xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:exsl="http://exslt.org/functions"
                xmlns:set="http://exslt.org/sets"
                extension-element-prefixes="exsl"
                exclude-result-prefixes="set">
    <xsl:output method="html"/>
    
  <xsl:key name="rpt" match="*" use="REPORT_TYPE"/>
  <xsl:key name="vst" match="*" use="concat(REPORT_TYPE, &apos;-&apos;, VISIT_ID)"/>
  <xsl:key name="cmp" match="*" use="concat(concat(REPORT_TYPE, &apos;-&apos;, VISIT_ID), &apos;-&apos;, AUDIT_COMPANY)"/>
  <xsl:key name="tpa" match="*" use="concat(concat(concat(REPORT_TYPE, &apos;-&apos;, VISIT_ID), &apos;-&apos;, AUDIT_COMPANY), &apos;-&apos;, TPA_AUDITOR)"/>
  <xsl:key name="asg" match="*" use="concat(concat(concat(concat(REPORT_TYPE, &apos;-&apos;, VISIT_ID), &apos;-&apos;, AUDIT_COMPANY), &apos;-&apos;, TPA_AUDITOR), &apos;-&apos;, ASSIGNMENTS)"/>
  
  
  <xsl:template match="/">
        <xsl:apply-templates select="ROWSET"/>
    </xsl:template>
    
    <xsl:template match="/ROWSET">
        <xsl:variable name="RT" select="REPORT_TYPE"></xsl:variable>
       <xsl:for-each select="*[generate-id() = generate-id(key(&apos;vst&apos;, concat(REPORT_TYPE, &apos;-&apos;, VISIT_ID))[1])]">
            <xsl:if test="not(position() = 1)">
            <xsl:text>,</xsl:text>
            </xsl:if>
      "<xsl:value-of select="REPORT_TYPE"/>":[

		  {
        <xsl:apply-templates select="*" mode="inner"/>,
     
   "AUDIT_COMPANIES":[
        <xsl:variable name="RT" select="REPORT_TYPE"></xsl:variable>
        <xsl:variable name="VI" select="VISIT_ID"></xsl:variable>
        <xsl:for-each select="../*[generate-id() = generate-id(key(&apos;cmp&apos;, concat(concat($RT, &apos;-&apos;, $VI), &apos;-&apos;, AUDIT_COMPANY) )[1])]">
          <xsl:if test="position() &gt; 1">
             <xsl:text>,</xsl:text>
             <xsl:text>&#10;</xsl:text>
        </xsl:if>
          {
      <xsl:apply-templates select="AUDIT_COMPANY" mode="grouped-cmp"/>
      
       <xsl:apply-templates select="*" mode="grouped-cmp"/>,
      "AUDITORS":[
        <xsl:variable name="RT" select="REPORT_TYPE"></xsl:variable>
        <xsl:variable name="VI" select="VISIT_ID"></xsl:variable>
        <xsl:variable name="AC" select="AUDIT_COMPANY"></xsl:variable>
    <xsl:for-each select="../*[generate-id() = generate-id(key(&apos;tpa&apos;, concat(concat(concat($RT, &apos;-&apos;, $VI), &apos;-&apos;, $AC), &apos;-&apos;, TPA_AUDITOR))[1])]">
          <xsl:if test="position() &gt; 1">
             <xsl:text>,</xsl:text>
             <xsl:text>&#10;</xsl:text>
        </xsl:if>
          {
          <xsl:apply-templates select="*" mode="grouped-tpa"/>,
              "ASSIGNMENTS":[
              <xsl:variable name="RT" select="REPORT_TYPE"></xsl:variable>
        <xsl:variable name="VI" select="VISIT_ID"></xsl:variable>
              <xsl:variable name="AC" select="AUDIT_COMPANY"></xsl:variable>
              <xsl:variable name="TA" select="TPA_AUDITOR"></xsl:variable>
              <xsl:for-each select="../*[generate-id() = generate-id(key(&apos;asg&apos;, concat(concat(concat(concat($RT, &apos;-&apos;, $VI), &apos;-&apos;, $AC), &apos;-&apos;, $TA), &apos;-&apos;, ASSIGNMENTS) )[1])]">
                <xsl:if test="position() &gt; 1">
                   <xsl:text>,</xsl:text>
                   <xsl:text>&#10;</xsl:text>
                </xsl:if>
                {
                <xsl:apply-templates select="*" mode="grouped-asg"/>
                }
              </xsl:for-each>
            ]
          }
        </xsl:for-each>
        ]
      }
        </xsl:for-each>
     ]
    }
       ]
        </xsl:for-each>
        }
    </xsl:template>
    
   
    <xsl:template match="*" mode="inner">
        <xsl:if test="position() &gt; 1 and position() &lt; 34">
      <xsl:text>,</xsl:text>
      <xsl:text>&#10;</xsl:text>
        </xsl:if>
    <xsl:if test="position()&lt;34">
      <xsl:text>"</xsl:text>
      
      <xsl:value-of select="name()"/>
      <xsl:text>":"</xsl:text>
      <xsl:value-of select="text()"/>
      <xsl:text>"</xsl:text>
        </xsl:if>
    </xsl:template>
  
      <xsl:template match="*" mode="grouped-cmp">
      <xsl:if test="position()=34">
      <xsl:text>"</xsl:text>
      <xsl:value-of select="name()"/>
      <xsl:text>":"</xsl:text>
      <xsl:value-of select="text()"/>
      <xsl:text>"</xsl:text>
      </xsl:if>
    </xsl:template>
    
    <xsl:template match="*" mode="grouped-tpa">
      <xsl:if test="position() = 36">
        <xsl:text>,</xsl:text>
        <xsl:text>&#10;</xsl:text>
      </xsl:if>
      <xsl:if test="position()&gt;34 and position()&lt;37">
      <xsl:text>"</xsl:text>
      <xsl:value-of select="name()"/>
      <xsl:text>":"</xsl:text>
      <xsl:value-of select="text()"/>
      <xsl:text>"</xsl:text>
      </xsl:if>
    </xsl:template>
    
    <xsl:template match="*" mode="grouped-asg">
      <xsl:if test="position() = 37">
			<xsl:text>"</xsl:text>
			<xsl:value-of select="name()"/>
			<xsl:text>":"</xsl:text>
			<xsl:value-of select="text()"/>
			<xsl:text>"</xsl:text>
      </xsl:if>
    </xsl:template>
    </xsl:stylesheet>

Open in new window



Which give the result of the JSON output as like below:

  {
      "metadata": {
                "VISIT_TYPE":"TEST"
      },
      "UPCOMING":[

		  {
        "REPORT_TYPE":"UPCOMING",
"VISIT_STATUS":"Pre-Audit - Audit Planned",
"VISIT_STATUS_ID":"1",
"VISIT_ID":"V12-4002-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"139968",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"4002",
"FACILITY_NAME":"AAC Acoustic Technologies Ltd. (American Audio Company)",
"CITY":"Shenzhen",
"STATE_PROVINCE":"Guangdong",
"COUNTRY":"China",
"FACILITY_ADDRESS":"Building 5, 6th floor, Nanyou Tianan Industry Park, Dengliang Road, NanShan District",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"D",
"VS_PID":"139960",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Eve SGM",
"APPLE_VERIFICATION_LEAD":"Kari SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"15-NOV-13",
"PROTOCOL_NAME":"Code of Conduct Provision - November Protocol",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 15 - NOV 16,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"David SGM",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Disclosure of Information"
                }
              ,

                {
                "ASSIGNMENTS":"Business Integrity"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"Charles SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Facility"
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "UPCOMING":[

		  {
        "REPORT_TYPE":"UPCOMING",
"VISIT_STATUS":"Pre-Audit - Audit Planned",
"VISIT_STATUS_ID":"1",
"VISIT_ID":"V284-5287-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"141965",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5287",
"FACILITY_NAME":"Unipart Technology Logistics",
"CITY":"Lutterworth",
"STATE_PROVINCE":"Lutterworth",
"COUNTRY":"United Kingdom",
"FACILITY_ADDRESS":"Vulcan Point, Vulcan Way, Magna Park",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"Y",
"VS_PID":"141957",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Charlie SGM",
"APPLE_VERIFICATION_LEAD":"Nina SGM",
"SR_PROGRAM_MANAGER":"Bob SGM",
"START_DATE":"16-NOV-13",
"PROTOCOL_NAME":"Test Protocol 10",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 16 - NOV 16,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Sathwick Rao",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Antidiscrimination"
                }
              ,

                {
                "ASSIGNMENTS":"Labor &#38; Human Rights"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"David SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Antidiscrimination"
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "TODAY":[

		  {
        "REPORT_TYPE":"TODAY",
"VISIT_STATUS":"Audit In Progress",
"VISIT_STATUS_ID":"4",
"VISIT_ID":"V12-5302-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"140250",
"INSTANCE_ID":"",
"IS_OFFLINE":"N",
"FACILITY_ID":"5302",
"FACILITY_NAME":"Tripod Taiwan",
"CITY":"Taichung",
"STATE_PROVINCE":"Taichung",
"COUNTRY":"Taiwan",
"FACILITY_ADDRESS":"No.13, Kung-Yeh 3rd Rd., Ping-Jen Industrial Park, Ping-Jen City",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"D",
"VS_PID":"140242",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Eve SGM",
"APPLE_VERIFICATION_LEAD":"Nina SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"15-NOV-13",
"PROTOCOL_NAME":"Protocol test by sreedhar to validate CAP",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 15 - NOV 16,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Scott SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Environment"
                }
              ,

                {
                "ASSIGNMENTS":"Disclosure of Information"
                }
              ,

                {
                "ASSIGNMENTS":"Business Integrity"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"David SGM",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Environment"
                }
              ,

                {
                "ASSIGNMENTS":"Ethics"
                }
              ,

                {
                "ASSIGNMENTS":"Hazardous Substance Management and Restrictions"
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "TODAY":[

		  {
        "REPORT_TYPE":"TODAY",
"VISIT_STATUS":"Audit In Progress",
"VISIT_STATUS_ID":"4",
"VISIT_ID":"V288-5287-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"142469",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5287",
"FACILITY_NAME":"Unipart Technology Logistics",
"CITY":"Lutterworth",
"STATE_PROVINCE":"Lutterworth",
"COUNTRY":"United Kingdom",
"FACILITY_ADDRESS":"Vulcan Point, Vulcan Way, Magna Park",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"Y",
"VS_PID":"142466",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Charlie SGM",
"APPLE_VERIFICATION_LEAD":"Nina SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"16-NOV-13",
"PROTOCOL_NAME":"Test Protocol 10",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 16 - NOV 16,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Sathwick Rao",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Antidiscrimination"
                }
              ,

                {
                "ASSIGNMENTS":"Labor &#38; Human Rights"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"David SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":""
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "TODAY":[

		  {
        "REPORT_TYPE":"TODAY",
"VISIT_STATUS":"Audit In Progress",
"VISIT_STATUS_ID":"4",
"VISIT_ID":"V95-5293-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"138700",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5293",
"FACILITY_NAME":"United Test and Assembly Center Ltd.",
"CITY":"Singapore",
"STATE_PROVINCE":"Singapore",
"COUNTRY":"Singapore",
"FACILITY_ADDRESS":"5 Serangoon North Avenue 5",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"D",
"VS_PID":"138692",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Eve SGM",
"APPLE_VERIFICATION_LEAD":"Nina SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"14-NOV-13",
"PROTOCOL_NAME":"Test Protocol 12",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 14 - NOV 16,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"PWC",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Maggie SGM",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Property Protection"
                }
              ,

                {
                "ASSIGNMENTS":"Disclosure of Information"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"Leo SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Disclosure of Information"
                }
              
            ]
          }
        
        ]
      }
        ,

          {
      "AUDIT_COMPANY":"Golder",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Jasmin SGM",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":""
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"Jake SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Disclosure of Information"
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "TODAY":[

		  {
        "REPORT_TYPE":"TODAY",
"VISIT_STATUS":"Audit In Progress",
"VISIT_STATUS_ID":"4",
"VISIT_ID":"V292-5287-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"142788",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5287",
"FACILITY_NAME":"Unipart Technology Logistics",
"CITY":"Lutterworth",
"STATE_PROVINCE":"Lutterworth",
"COUNTRY":"United Kingdom",
"FACILITY_ADDRESS":"Vulcan Point, Vulcan Way, Magna Park",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"Y",
"VS_PID":"142780",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Charlie SGM",
"APPLE_VERIFICATION_LEAD":"Nina SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"16-NOV-13",
"PROTOCOL_NAME":"Test Protocol 10",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 16 - NOV 16,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Sathwick Rao",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Labor &#38; Human Rights"
                }
              ,

                {
                "ASSIGNMENTS":"Antidiscrimination"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"David SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":""
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "TODAY":[

		  {
        "REPORT_TYPE":"TODAY",
"VISIT_STATUS":"Audit In Progress",
"VISIT_STATUS_ID":"4",
"VISIT_ID":"V287-5287-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"142462",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5287",
"FACILITY_NAME":"Unipart Technology Logistics",
"CITY":"Lutterworth",
"STATE_PROVINCE":"Lutterworth",
"COUNTRY":"United Kingdom",
"FACILITY_ADDRESS":"Vulcan Point, Vulcan Way, Magna Park",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"Y",
"VS_PID":"142457",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Charlie SGM",
"APPLE_VERIFICATION_LEAD":"Nina SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"16-NOV-13",
"PROTOCOL_NAME":"Test Protocol 10",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 16 - NOV 16,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Sathwick Rao",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Labor &#38; Human Rights"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"David SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":""
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"Charles SGM",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":""
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "TODAY":[

		  {
        "REPORT_TYPE":"TODAY",
"VISIT_STATUS":"Audit In Progress",
"VISIT_STATUS_ID":"4",
"VISIT_ID":"V285-5287-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"142362",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5287",
"FACILITY_NAME":"Unipart Technology Logistics",
"CITY":"Lutterworth",
"STATE_PROVINCE":"Lutterworth",
"COUNTRY":"United Kingdom",
"FACILITY_ADDRESS":"Vulcan Point, Vulcan Way, Magna Park",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"Y",
"VS_PID":"142359",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Charlie SGM",
"APPLE_VERIFICATION_LEAD":"Kari SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"16-NOV-13",
"PROTOCOL_NAME":"Test Protocol 10",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 16 - NOV 16,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Sathwick Rao",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Labor &#38; Human Rights"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"David SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":""
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "TODAY":[

		  {
        "REPORT_TYPE":"TODAY",
"VISIT_STATUS":"Audit In Progress",
"VISIT_STATUS_ID":"4",
"VISIT_ID":"V279-5287-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"138945",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5287",
"FACILITY_NAME":"Unipart Technology Logistics",
"CITY":"Lutterworth",
"STATE_PROVINCE":"Lutterworth",
"COUNTRY":"United Kingdom",
"FACILITY_ADDRESS":"Vulcan Point, Vulcan Way, Magna Park",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"Y",
"VS_PID":"138940",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Charlie SGM",
"APPLE_VERIFICATION_LEAD":"Kari SGM",
"SR_PROGRAM_MANAGER":"Bob SGM",
"START_DATE":"14-NOV-13",
"PROTOCOL_NAME":"Code of Conduct Provision - November Protocol",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 14 - NOV 15,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Golder",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Jake SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Facility"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"Jasmin SGM",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":""
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "TODAY":[

		  {
        "REPORT_TYPE":"TODAY",
"VISIT_STATUS":"Audit In Progress",
"VISIT_STATUS_ID":"4",
"VISIT_ID":"V283-5287-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"140646",
"INSTANCE_ID":"",
"IS_OFFLINE":"N",
"FACILITY_ID":"5287",
"FACILITY_NAME":"Unipart Technology Logistics",
"CITY":"Lutterworth",
"STATE_PROVINCE":"Lutterworth",
"COUNTRY":"United Kingdom",
"FACILITY_ADDRESS":"Vulcan Point, Vulcan Way, Magna Park",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"Y",
"VS_PID":"140635",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Charlie SGM",
"APPLE_VERIFICATION_LEAD":"Nina SGM",
"SR_PROGRAM_MANAGER":"Bob SGM",
"START_DATE":"15-NOV-13",
"PROTOCOL_NAME":"Test Protocol 10",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 15 - NOV 15,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Charles SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Antidiscrimination"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"Sathwick Rao",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Labor &#38; Human Rights"
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "TODAY":[

		  {
        "REPORT_TYPE":"TODAY",
"VISIT_STATUS":"Audit In Progress",
"VISIT_STATUS_ID":"4",
"VISIT_ID":"V97-5293-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"138995",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5293",
"FACILITY_NAME":"United Test and Assembly Center Ltd.",
"CITY":"Singapore",
"STATE_PROVINCE":"Singapore",
"COUNTRY":"Singapore",
"FACILITY_ADDRESS":"5 Serangoon North Avenue 5",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"D",
"VS_PID":"138988",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Eve SGM",
"APPLE_VERIFICATION_LEAD":"Nina SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"14-NOV-13",
"PROTOCOL_NAME":"Environment Protocol",
"TPA_DATE":"NOV 21,2013",
"FINAL_REPORT_DEADLINE":"NOV 25,2013",
"SHOW_DATE":"NOV 14 - NOV 14,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Golder",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Jasmin SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":""
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "FINAL":[

		  {
        "REPORT_TYPE":"FINAL",
"VISIT_STATUS":"Pending TPA Submission",
"VISIT_STATUS_ID":"5",
"VISIT_ID":"V286-5287-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"142390",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5287",
"FACILITY_NAME":"Unipart Technology Logistics",
"CITY":"Lutterworth",
"STATE_PROVINCE":"Lutterworth",
"COUNTRY":"United Kingdom",
"FACILITY_ADDRESS":"Vulcan Point, Vulcan Way, Magna Park",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"Y",
"VS_PID":"142387",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Charlie SGM",
"APPLE_VERIFICATION_LEAD":"Kari SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"16-NOV-13",
"PROTOCOL_NAME":"Test Protocol 10",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 16 - NOV 16,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"David SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Antidiscrimination"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"Sathwick Rao",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Antidiscrimination"
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "FINAL":[

		  {
        "REPORT_TYPE":"FINAL",
"VISIT_STATUS":"Pending TPA Submission",
"VISIT_STATUS_ID":"5",
"VISIT_ID":"V282-5287-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"140437",
"INSTANCE_ID":"",
"IS_OFFLINE":"N",
"FACILITY_ID":"5287",
"FACILITY_NAME":"Unipart Technology Logistics",
"CITY":"Lutterworth",
"STATE_PROVINCE":"Lutterworth",
"COUNTRY":"United Kingdom",
"FACILITY_ADDRESS":"Vulcan Point, Vulcan Way, Magna Park",
"FACILITY_LOCAL_NAME":"Lutterworth",
"FACILITY_LOCAL_ADDRESS":"Lutterworth",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"D",
"VS_PID":"140433",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Lara SGM",
"APPLE_VERIFICATION_LEAD":"Kari SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"15-NOV-13",
"PROTOCOL_NAME":"Test Protocol 10",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 15 - NOV 15,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"David SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Labor &#38; Human Rights"
                }
              ,

                {
                "ASSIGNMENTS":"Antidiscrimination"
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "FINAL":[

		  {
        "REPORT_TYPE":"FINAL",
"VISIT_STATUS":"Pending TPA Submission",
"VISIT_STATUS_ID":"5",
"VISIT_ID":"V109-5293-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"143593",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5293",
"FACILITY_NAME":"United Test and Assembly Center Ltd.",
"CITY":"Singapore",
"STATE_PROVINCE":"Singapore",
"COUNTRY":"Singapore",
"FACILITY_ADDRESS":"5 Serangoon North Avenue 5",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"Y",
"VS_PID":"143588",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Charlie SGM",
"APPLE_VERIFICATION_LEAD":"Paris SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"17-NOV-13",
"PROTOCOL_NAME":"Test Protocol 10",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 17 - NOV 17,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Charles SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Antidiscrimination"
                }
              ,

                {
                "ASSIGNMENTS":"Labor &#38; Human Rights"
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "UPCOMING":[

		  {
        "REPORT_TYPE":"UPCOMING",
"VISIT_STATUS":"Pre-Audit - Audit Planned",
"VISIT_STATUS_ID":"1",
"VISIT_ID":"V96-5293-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"138922",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5293",
"FACILITY_NAME":"United Test and Assembly Center Ltd.",
"CITY":"Singapore",
"STATE_PROVINCE":"Singapore",
"COUNTRY":"Singapore",
"FACILITY_ADDRESS":"5 Serangoon North Avenue 5",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"Y",
"VS_PID":"138917",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Charlie SGM",
"APPLE_VERIFICATION_LEAD":"Kari SGM",
"SR_PROGRAM_MANAGER":"Bob SGM",
"START_DATE":"15-NOV-13",
"PROTOCOL_NAME":"Code of Conduct Provision - November Protocol",
"TPA_DATE":"NOV 29,2013",
"FINAL_REPORT_DEADLINE":"DEC 03,2013",
"SHOW_DATE":"NOV 15 - NOV 22,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Golder",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Jasmin SGM",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Facility"
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"Jake SGM",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Antidiscrimination"
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        ,
      "UPCOMING":[

		  {
        "REPORT_TYPE":"UPCOMING",
"VISIT_STATUS":"Pre-Audit - Audit Planned",
"VISIT_STATUS_ID":"1",
"VISIT_ID":"V13-5300-2013-11",
"USER_ID":"100125",
"APP_ASSIGNMENT_ID":"3",
"METRIC_ID":"101652",
"PID":"142822",
"INSTANCE_ID":"",
"IS_OFFLINE":"",
"FACILITY_ID":"5300",
"FACILITY_NAME":"VMARK",
"CITY":"Downers Grove",
"STATE_PROVINCE":"Illinois",
"COUNTRY":"USA",
"FACILITY_ADDRESS":"5200 Thatcher Road",
"FACILITY_LOCAL_NAME":"",
"FACILITY_LOCAL_ADDRESS":"",
"LONGITUDE":"",
"LATITUDE":"",
"VISIT_EDIT_FLAG":"D",
"VS_EDIT_FLAG":"Y",
"VS_PID":"142817",
"VS_METRIC_ID":"101661",
"ONSITE_LEAD":"Charlie SGM",
"APPLE_LEAD":"Charlie SGM",
"APPLE_VERIFICATION_LEAD":"Nina SGM",
"SR_PROGRAM_MANAGER":"Fanky SGM",
"START_DATE":"17-NOV-13",
"PROTOCOL_NAME":"Test Protocol 10",
"TPA_DATE":"NOV 22,2013",
"FINAL_REPORT_DEADLINE":"NOV 26,2013",
"SHOW_DATE":"NOV 17 - NOV 17,2013",
     
   "AUDIT_COMPANIES":[
        
          {
      "AUDIT_COMPANY":"Verite",
      "AUDITORS":[
        
          {
          "TPA_AUDITOR":"Sathwick Rao",
"IS_LEAD":"1",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":""
                }
              
            ]
          }
        ,

          {
          "TPA_AUDITOR":"David SGM",
"IS_LEAD":"0",
              "ASSIGNMENTS":[
              
                {
                "ASSIGNMENTS":"Wages &#38; Benefits"
                }
              ,

                {
                "ASSIGNMENTS":"Labor &#38; Human Rights"
                }
              ,

                {
                "ASSIGNMENTS":"Antidiscrimination"
                }
              
            ]
          }
        
        ]
      }
        
     ]
    }
       ]
        
        }
    

Open in new window


Can you guide me how to do it from XSLT or after getting the JSON output and then group it ?
Swadhin Ray

ASKER
The original JSON output which I am getting from database is as like below:

Original JSON OUTPUT
I want to make it before parsing as like below:

Expected JSON OUTPUT
So finally I should be getting the data like below , so that while parsing it I will not be having any issues:

{
    "metadata": {
        "USER_TYPE": "APPLE LEAD"
    },
    "TODAY": [
        {
            "REPORT_TYPE": "TODAY",
            "VISIT_STATUS": "Audit In Progress",
            "VISIT_STATUS_ID": "4",
            "VISIT_ID": "V100-5293-2013-11",
            "USER_ID": "100124",
            "APP_ASSIGNMENT_ID": "3",
            "METRIC_ID": "101652",
            "PID": "139876",
            "INSTANCE_ID": "",
            "IS_OFFLINE": "",
            "FACILITY_ID": "5293",
            "FACILITY_NAME": "United Test and Assembly Center Ltd.",
            "CITY": "Singapore",
            "STATE_PROVINCE": "Singapore",
            "COUNTRY": "Singapore",
            "FACILITY_ADDRESS": "5 Serangoon North Avenue 5",
            "FACILITY_LOCAL_NAME": "",
            "FACILITY_LOCAL_ADDRESS": "",
            "LONGITUDE": "",
            "LATITUDE": "",
            "VISIT_EDIT_FLAG": "D",
            "VS_EDIT_FLAG": "D",
            "VS_PID": "139870",
            "VS_METRIC_ID": "101661",
            "ONSITE_LEAD": "Eve SGM",
            "APPLE_LEAD": "Lara SGM",
            "APPLE_VERIFICATION_LEAD": "Nina SGM",
            "SR_PROGRAM_MANAGER": "Bob SGM",
            "START_DATE": "14-NOV-13",
            "PROTOCOL_NAME": "Code of Conduct Provision - November Protocol",
            "TPA_DATE": "NOV 22,2013",
            "FINAL_REPORT_DEADLINE": "NOV 26,2013",
            "SHOW_DATE": "NOV 14 - NOV 15,2013",
            "AUDIT_COMPANIES": [
                {
                    "AUDIT_COMPANY": "Golder",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Jake SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Facility"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Jasmin SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Facility"
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "REPORT_TYPE": "TODAY",
            "VISIT_STATUS": "Audit In Progress",
            "VISIT_STATUS_ID": "4",
            "VISIT_ID": "V98-5293-2013-11",
            "USER_ID": "100124",
            "APP_ASSIGNMENT_ID": "3",
            "METRIC_ID": "101652",
            "PID": "139018",
            "INSTANCE_ID": "",
            "IS_OFFLINE": "",
            "FACILITY_ID": "5293",
            "FACILITY_NAME": "United Test and Assembly Center Ltd.",
            "CITY": "Singapore",
            "STATE_PROVINCE": "Singapore",
            "COUNTRY": "Singapore",
            "FACILITY_ADDRESS": "5 Serangoon North Avenue 5",
            "FACILITY_LOCAL_NAME": "",
            "FACILITY_LOCAL_ADDRESS": "",
            "LONGITUDE": "",
            "LATITUDE": "",
            "VISIT_EDIT_FLAG": "D",
            "VS_EDIT_FLAG": "Y",
            "VS_PID": "139014",
            "VS_METRIC_ID": "101661",
            "ONSITE_LEAD": "Eve SGM",
            "APPLE_LEAD": "Eve SGM",
            "APPLE_VERIFICATION_LEAD": "Nina SGM",
            "SR_PROGRAM_MANAGER": "Fanky SGM",
            "START_DATE": "14-NOV-13",
            "PROTOCOL_NAME": "Protocol test by sreedhar to validate CAP",
            "TPA_DATE": "NOV 22,2013",
            "FINAL_REPORT_DEADLINE": "NOV 26,2013",
            "SHOW_DATE": "NOV 14 - NOV 15,2013",
            "AUDIT_COMPANIES": [
                {
                    "AUDIT_COMPANY": "Verite",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Scott SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Property Protection"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Charles SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Ethics"
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "REPORT_TYPE": "TODAY",
            "VISIT_STATUS": "Audit In Progress",
            "VISIT_STATUS_ID": "4",
            "VISIT_ID": "V11-5300-2013-11",
            "USER_ID": "100124",
            "APP_ASSIGNMENT_ID": "3",
            "METRIC_ID": "101652",
            "PID": "139047",
            "INSTANCE_ID": "",
            "IS_OFFLINE": "",
            "FACILITY_ID": "5300",
            "FACILITY_NAME": "VMARK",
            "CITY": "Downers Grove",
            "STATE_PROVINCE": "Illinois",
            "COUNTRY": "USA",
            "FACILITY_ADDRESS": "5200 Thatcher Road",
            "FACILITY_LOCAL_NAME": "",
            "FACILITY_LOCAL_ADDRESS": "",
            "LONGITUDE": "",
            "LATITUDE": "",
            "VISIT_EDIT_FLAG": "D",
            "VS_EDIT_FLAG": "Y",
            "VS_PID": "139040",
            "VS_METRIC_ID": "101661",
            "ONSITE_LEAD": "Eve SGM",
            "APPLE_LEAD": "Eve SGM",
            "APPLE_VERIFICATION_LEAD": "Nina SGM",
            "SR_PROGRAM_MANAGER": "Fanky SGM",
            "START_DATE": "14-NOV-13",
            "PROTOCOL_NAME": "Code of Conduct Provision - November Protocol",
            "TPA_DATE": "NOV 22,2013",
            "FINAL_REPORT_DEADLINE": "NOV 26,2013",
            "SHOW_DATE": "NOV 14 - NOV 15,2013",
            "AUDIT_COMPANIES": [
                {
                    "AUDIT_COMPANY": "Golder",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Jake SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Emergency Prevention, Preparedness and Response"
                                },
                                {
                                    "ASSIGNMENTS": "Ethics"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Jasmin SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                },
                                {
                                    "ASSIGNMENTS": "Management Systems"
                                }
                            ]
                        }
                    ]
                },
                {
                    "AUDIT_COMPANY": "Verite",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Charles SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Emergency Prevention, Preparedness and Response"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "David SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Hazardous Substance Management and Restrictions"
                                },
                                {
                                    "ASSIGNMENTS": "Hazardous Substance Management and Restrictions 1"
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "REPORT_TYPE": "TODAY",
            "VISIT_STATUS": "Audit In Progress",
            "VISIT_STATUS_ID": "4",
            "VISIT_ID": "V13-4002-2013-11",
            "USER_ID": "100124",
            "APP_ASSIGNMENT_ID": "3",
            "METRIC_ID": "101652",
            "PID": "145748",
            "INSTANCE_ID": "",
            "IS_OFFLINE": "N",
            "FACILITY_ID": "4002",
            "FACILITY_NAME": "AAC Acoustic Technologies Ltd. (American Audio Company)",
            "CITY": "Shenzhen",
            "STATE_PROVINCE": "Guangdong",
            "COUNTRY": "China",
            "FACILITY_ADDRESS": "Building 5, 6th floor, Nanyou Tianan Industry Park, Dengliang Road, NanShan District",
            "FACILITY_LOCAL_NAME": "",
            "FACILITY_LOCAL_ADDRESS": "",
            "LONGITUDE": "",
            "LATITUDE": "",
            "VISIT_EDIT_FLAG": "D",
            "VS_EDIT_FLAG": "D",
            "VS_PID": "145691",
            "VS_METRIC_ID": "101661",
            "ONSITE_LEAD": "Eve SGM",
            "APPLE_LEAD": "Lara SGM",
            "APPLE_VERIFICATION_LEAD": "Nina SGM",
            "SR_PROGRAM_MANAGER": "Bob SGM",
            "START_DATE": "18-NOV-13",
            "PROTOCOL_NAME": "Test Protocol 10",
            "TPA_DATE": "DEC 06,2013",
            "FINAL_REPORT_DEADLINE": "DEC 10,2013",
            "SHOW_DATE": "NOV 18 - NOV 30,2013",
            "AUDIT_COMPANIES": [
                {
                    "AUDIT_COMPANY": "Golder",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Jake SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                },
                                {
                                    "ASSIGNMENTS": "Wages &#38; Benefits"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Jasmin SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Antidiscrimination"
                                },
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Yasmin SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Antidiscrimination"
                                }
                            ]
                        }
                    ]
                },
                {
                    "AUDIT_COMPANY": "PWC",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Leo SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Antidiscrimination"
                                },
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Maggie SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                },
                                {
                                    "ASSIGNMENTS": "Wages &#38; Benefits"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Maria SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Antidiscrimination"
                                },
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                },
                                {
                                    "ASSIGNMENTS": "Wages &#38; Benefits"
                                }
                            ]
                        }
                    ]
                },
                {
                    "AUDIT_COMPANY": "Supplier Responsibility",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Gia SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Antidiscrimination"
                                },
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                },
                                {
                                    "ASSIGNMENTS": "Wages &#38; Benefits"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Ruth SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Antidiscrimination"
                                },
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Ryan SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                },
                                {
                                    "ASSIGNMENTS": "Wages &#38; Benefits"
                                }
                            ]
                        }
                    ]
                },
                {
                    "AUDIT_COMPANY": "Verite",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Charles SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Antidiscrimination"
                                },
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "David SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Antidiscrimination"
                                },
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                },
                                {
                                    "ASSIGNMENTS": "Wages &#38; Benefits"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Scott SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                },
                                {
                                    "ASSIGNMENTS": "Wages &#38; Benefits"
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "REPORT_TYPE": "TODAY",
            "VISIT_STATUS": "Audit In Progress",
            "VISIT_STATUS_ID": "4",
            "VISIT_ID": "V15-5343-2013-11",
            "USER_ID": "100124",
            "APP_ASSIGNMENT_ID": "3",
            "METRIC_ID": "101652",
            "PID": "138985",
            "INSTANCE_ID": "",
            "IS_OFFLINE": "",
            "FACILITY_ID": "5343",
            "FACILITY_NAME": "Volex Cable Assembly Co. Ltd.",
            "CITY": "Shenzhen",
            "STATE_PROVINCE": "Guangdong",
            "COUNTRY": "China",
            "FACILITY_ADDRESS": "No. 1173, Shenhui Road, Henggang",
            "FACILITY_LOCAL_NAME": "",
            "FACILITY_LOCAL_ADDRESS": "",
            "LONGITUDE": "",
            "LATITUDE": "",
            "VISIT_EDIT_FLAG": "D",
            "VS_EDIT_FLAG": "D",
            "VS_PID": "138969",
            "VS_METRIC_ID": "101661",
            "ONSITE_LEAD": "Eve SGM",
            "APPLE_LEAD": "S48 Rao",
            "APPLE_VERIFICATION_LEAD": "Nina SGM",
            "SR_PROGRAM_MANAGER": "Fanky SGM",
            "START_DATE": "14-NOV-13",
            "PROTOCOL_NAME": "Protocol by sreedhar test",
            "TPA_DATE": "NOV 14,2013",
            "FINAL_REPORT_DEADLINE": "NOV 15,2013",
            "SHOW_DATE": "NOV 14 - NOV 14,2013",
            "AUDIT_COMPANIES": [
                {
                    "AUDIT_COMPANY": "PWC",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Leo SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Facility"
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "REPORT_TYPE": "TODAY",
            "VISIT_STATUS": "Audit In Progress",
            "VISIT_STATUS_ID": "4",
            "VISIT_ID": "V8-5342-2013-11",
            "USER_ID": "100124",
            "APP_ASSIGNMENT_ID": "3",
            "METRIC_ID": "101652",
            "PID": "140688",
            "INSTANCE_ID": "",
            "IS_OFFLINE": "N",
            "FACILITY_ID": "5342",
            "FACILITY_NAME": "Vitalo Packaging Co. Ltd.",
            "CITY": "Suzhou",
            "STATE_PROVINCE": "Jiangsu",
            "COUNTRY": "China",
            "FACILITY_ADDRESS": "Suzhou Industrial Park Wang Pu No. 3, Lane 江苏苏州工业园区横浦巷3号",
            "FACILITY_LOCAL_NAME": "维塔罗包装(苏州)有限公司",
            "FACILITY_LOCAL_ADDRESS": "",
            "LONGITUDE": "",
            "LATITUDE": "",
            "VISIT_EDIT_FLAG": "D",
            "VS_EDIT_FLAG": "D",
            "VS_PID": "140684",
            "VS_METRIC_ID": "101661",
            "ONSITE_LEAD": "Eve SGM",
            "APPLE_LEAD": "Lara SGM",
            "APPLE_VERIFICATION_LEAD": "Nina SGM",
            "SR_PROGRAM_MANAGER": "Tom SGM",
            "START_DATE": "15-NOV-13",
            "PROTOCOL_NAME": "Code of Conduct Provision - November Protocol",
            "TPA_DATE": "NOV 22,2013",
            "FINAL_REPORT_DEADLINE": "NOV 26,2013",
            "SHOW_DATE": "NOV 15 - NOV 16,2013",
            "AUDIT_COMPANIES": [
                {
                    "AUDIT_COMPANY": "Golder",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Yasmin SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Facility"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Jasmin SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": ""
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ],
    "UPCOMING": [
        {
            "REPORT_TYPE": "UPCOMING",
            "VISIT_STATUS": "Pre-Audit - Audit Planned",
            "VISIT_STATUS_ID": "1",
            "VISIT_ID": "V5-5349-2013-11",
            "USER_ID": "100124",
            "APP_ASSIGNMENT_ID": "3",
            "METRIC_ID": "101652",
            "PID": "145848",
            "INSTANCE_ID": "",
            "IS_OFFLINE": "N",
            "FACILITY_ID": "5349",
            "FACILITY_NAME": "Walton Advanced Engineering Inc.",
            "CITY": "Kaohsiung",
            "STATE_PROVINCE": "Kaohsiung",
            "COUNTRY": "Taiwan",
            "FACILITY_ADDRESS": "No.18 North First Road, K.E.P.Z. 806",
            "FACILITY_LOCAL_NAME": "",
            "FACILITY_LOCAL_ADDRESS": "",
            "LONGITUDE": "",
            "LATITUDE": "",
            "VISIT_EDIT_FLAG": "D",
            "VS_EDIT_FLAG": "Y",
            "VS_PID": "145840",
            "VS_METRIC_ID": "101661",
            "ONSITE_LEAD": "Eve SGM",
            "APPLE_LEAD": "Eve SGM",
            "APPLE_VERIFICATION_LEAD": "Nina SGM",
            "SR_PROGRAM_MANAGER": "Bob SGM",
            "START_DATE": "20-NOV-13",
            "PROTOCOL_NAME": "Test Protocol 10",
            "TPA_DATE": "NOV 29,2013",
            "FINAL_REPORT_DEADLINE": "DEC 03,2013",
            "SHOW_DATE": "NOV 20 - NOV 22,2013",
            "AUDIT_COMPANIES": [
                {
                    "AUDIT_COMPANY": "Golder",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Jasmin SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Labor &#38; Human Rights"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Jake SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Wages &#38; Benefits"
                                },
                                {
                                    "ASSIGNMENTS": "Antidiscrimination"
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "REPORT_TYPE": "UPCOMING",
            "VISIT_STATUS": "Pre-Audit - Audit Planned",
            "VISIT_STATUS_ID": "1",
            "VISIT_ID": "V280-5287-2013-11",
            "USER_ID": "100124",
            "APP_ASSIGNMENT_ID": "3",
            "METRIC_ID": "101652",
            "PID": "139688",
            "INSTANCE_ID": "",
            "IS_OFFLINE": "",
            "FACILITY_ID": "5287",
            "FACILITY_NAME": "Unipart Technology Logistics",
            "CITY": "Lutterworth",
            "STATE_PROVINCE": "Lutterworth",
            "COUNTRY": "United Kingdom",
            "FACILITY_ADDRESS": "Vulcan Point, Vulcan Way, Magna Park",
            "FACILITY_LOCAL_NAME": "",
            "FACILITY_LOCAL_ADDRESS": "",
            "LONGITUDE": "",
            "LATITUDE": "",
            "VISIT_EDIT_FLAG": "D",
            "VS_EDIT_FLAG": "D",
            "VS_PID": "139683",
            "VS_METRIC_ID": "101661",
            "ONSITE_LEAD": "Eve SGM",
            "APPLE_LEAD": "Lara SGM",
            "APPLE_VERIFICATION_LEAD": "Nina SGM",
            "SR_PROGRAM_MANAGER": "Fanky SGM",
            "START_DATE": "15-NOV-13",
            "PROTOCOL_NAME": "Test Protocol 10",
            "TPA_DATE": "NOV 22,2013",
            "FINAL_REPORT_DEADLINE": "NOV 26,2013",
            "SHOW_DATE": "NOV 15 - NOV 15,2013",
            "AUDIT_COMPANIES": [
                {
                    "AUDIT_COMPANY": "Golder",
                    "AUDITORS": [
                        {
                            "TPA_AUDITOR": "Jasmin SGM",
                            "IS_LEAD": "0",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": "Antidiscrimination"
                                }
                            ]
                        },
                        {
                            "TPA_AUDITOR": "Jake SGM",
                            "IS_LEAD": "1",
                            "ASSIGNMENTS": [
                                {
                                    "ASSIGNMENTS": ""
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

Open in new window

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Swadhin Ray

ASKER
Thanks