Unable to convert Json to XML

Jan 8, 2010 at 7:16 PM

This is my Json

[{
    "Cin":"00004",
    "Total":0,
    "Surplus":0
},....]

I get this error message: "XmlNodeConverter can only convert JSON that begins with an object" . I tried to add a root element but still the same problem. Any idea?

Thanks.

Jan 8, 2010 at 7:30 PM

This fixed it for me!!

System.Xml.XmlNode myXmlNode = JsonConvert.DeserializeXmlNode("{\"root\":" + TextResponse + "}", "root");

 

Aug 18, 2010 at 6:35 AM

Thank you!

Oct 21, 2010 at 7:11 AM

I am not able to deserialize this below json string

I am getting Index was outside the bounds of the array. error

{
  "8452309520V2": {
    "": {
      "CLIENT": {
        "ID_EXPIRATION_1": {
          "VALUE": "12/12/2000",
          "DATATYPE": "D",
          "MSG": "Missing Identification Exp. Date 1"
        },
        "ID_ISSUEDATE_1": {
          "VALUE": "",
          "DATATYPE": "D",
          "MSG": "Missing Identification Issue Date 1"
        }
      }
    },
    "457463534534": {
      "ACCOUNT": {
        "FUNDING_SOURCE": {
          "VALUE": "FS0",
          "DATATYPE": "L",
          "MSG": "Missing Source of Funds"
        }
      }
    }
  }
}{
  "34534634535345": {
    "": {
      "CLIENT": {
        "ID_NUMBER_1": {
          "VALUE": "",
          "DATATYPE": "S",
          "MSG": "Missing Picture ID"
        },
        "ID_EXPIRATION_1": {
          "VALUE": "12/12/2000",
          "DATATYPE": "D",
          "MSG": "Missing Picture ID"
        },
        "WALK_IN": {
          "VALUE": "",
          "DATATYPE": "L",
          "MSG": "Missing Walk in"
        },
        "PERSONAL_MEETING": {
          "VALUE": "PM1",
          "DATATYPE": "L",
          "MSG": "Missing Met Client in Person"
        },
        "ID_ISSUEDATE_1": {
          "VALUE": "",
          "DATATYPE": "D",
          "MSG": "Missing Picture ID"
        },
        "PHOTO_ID": {
          "VALUE": "",
          "DATATYPE": "L",
          "MSG": "Missing Picture ID"
        },
        "ID_TYPE_1": {
          "VALUE": "",
          "DATATYPE": "L",
          "MSG": "Missing Picture ID"
        }
      }
    },
    "45635624523": {
      "ACCOUNT": {
        "FUNDING_SOURCE": {
          "VALUE": "FS1",
          "DATATYPE": "L",
          "MSG": "Missing Source of Funds"
        }
      }
    }
  }
}

please help me

Coordinator
Oct 22, 2010 at 10:58 PM

The converter can't convert JSON with an empty property name. I've improved the error message in future for other users.

Apr 14, 2011 at 11:02 AM

That saved the day Thanks