Click here to Skip to main content
13,139,045 members (54,534 online)

Cannot convert xml to json

Siva Krishna asked:

Open original thread
here iam using jquery graph, for that i need to convert xml to json. so for that iam using xml2json.js
 success: function (msg) {
                    var json = $.xml2json(msg.d);
Here i am getting xml code as below. But it is not converting it. Can anyone help to solve it.

  <xs:schema id="NewDataSet" xmlns="" xmlns:xs="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Table">
              <xs:attribute name="Createddate" msdata:ReadOnly="true">
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="100" />
              <xs:attribute name="ReferralCount" msdata:ReadOnly="true" type="xs:int" />
  <Table Createddate="01/10/2013" ReferralCount="3" />
  <Table Createddate="01/18/2013" ReferralCount="11" />
  <Table Createddate="01/19/2013" ReferralCount="5" />
  <Table Createddate="06/13/2011" ReferralCount="2" />
  <Table Createddate="07/04/2012" ReferralCount="1" />
  <Table Createddate="07/05/2012" ReferralCount="3" />
  <Table Createddate="07/06/2012" ReferralCount="18" />
  <Table Createddate="07/09/2012" ReferralCount="48" />
  <Table Createddate="07/10/2012" ReferralCount="23" />
  <Table Createddate="07/11/2012" ReferralCount="2" />
  <Table Createddate="07/12/2012" ReferralCount="28" />
  <Table Createddate="07/13/2012" ReferralCount="25" />
  <Table Createddate="07/16/2012" ReferralCount="35" />
  <Table Createddate="07/17/2012" ReferralCount="99" />
  <Table Createddate="07/18/2012" ReferralCount="71" />
  <Table Createddate="07/19/2012" ReferralCount="40" />
  <Table Createddate="07/20/2012" ReferralCount="52" />
  <Table Createddate="07/23/2012" ReferralCount="107" />
  <Table Createddate="07/24/2012" ReferralCount="26" />
  <Table Createddate="07/25/2012" ReferralCount="77" />
  <Table Createddate="07/26/2012" ReferralCount="43" />
  <Table Createddate="07/27/2012" ReferralCount="13" />
  <Table Createddate="07/30/2012" ReferralCount="61" />
  <Table Createddate="07/31/2012" ReferralCount="31" />
  <Table Createddate="08/01/2012" ReferralCount="101" />
  <Table Createddate="08/02/2012" ReferralCount="21" />
  <Table Createddate="08/03/2012" ReferralCount="37" />
  <Table Createddate="08/06/2012" ReferralCount="58" />
  <Table Createddate="08/07/2012" ReferralCount="30" />
  <Table Createddate="08/08/2012" ReferralCount="10" />
  <Table Createddate="08/09/2012" ReferralCount="50" />
  <Table Createddate="08/10/2012" ReferralCount="10" />
  <Table Createddate="08/13/2012" ReferralCount="52" />
  <Table Createddate="08/14/2012" ReferralCount="39" />
  <Table Createddate="08/16/2012" ReferralCount="65" />
  <Table Createddate="08/17/2012" ReferralCount="17" />
  <Table Createddate="08/21/2012" ReferralCount="31" />
  <Table Createddate="08/22/2012" ReferralCount="8" />
  <Table Createddate="08/23/2012" ReferralCount="39" />
  <Table Createddate="08/24/2012" ReferralCount="81" />
  <Table Createddate="08/27/2012" ReferralCount="17" />
  <Table Createddate="08/28/2012" ReferralCount="24" />
  <Table Createddate="08/29/2012" ReferralCount="10" />
  <Table Createddate="08/30/2012" ReferralCount="43" />
  <Table Createddate="08/31/2012" ReferralCount="16" />
  <Table Createddate="09/03/2012" ReferralCount="12" />
  <Table Createddate="09/04/2012" ReferralCount="15" />
  <Table Createddate="09/05/2012" ReferralCount="33" />
  <Table Createddate="09/06/2012" ReferralCount="18" />
  <Table Createddate="09/07/2012" ReferralCount="3" />
  <Table Createddate="09/26/2012" ReferralCount="2" />
  <Table Createddate="10/20/2012" ReferralCount="21" />
  <Table Createddate="10/22/2012" ReferralCount="33" />
  <Table Createddate="10/29/2012" ReferralCount="1" />
  <Table Createddate="12/10/2012" ReferralCount="13" />
  <Table Createddate="12/11/2012" ReferralCount="5" />
  <Table Createddate="12/13/2012" ReferralCount="1" />
  <Table Createddate="12/14/2012" ReferralCount="4" />
  <Table Createddate="12/17/2012" ReferralCount="13" />
  <Table Createddate="12/18/2012" ReferralCount="5" />
  <Table Createddate="12/19/2012" ReferralCount="2" />
Tags: ASP.NET, jQuery


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100