using System.Collections.Generic;
using System.Xml.Serialization;
static T Deserialize<T>(string text, bool newNames)
JsonSerializerSettings settings = new JsonSerializerSettings();
settings.Formatting = Formatting.Indented;
settings.ContractResolver = new CustomNamesContractResolver();
return JsonConvert.DeserializeObject<T>(text, settings);
class CustomNamesContractResolver : Newtonsoft.Json.Serialization.DefaultContractResolver
protected override IList<Newtonsoft.Json.Serialization.JsonProperty> CreateProperties(System.Type type, MemberSerialization memberSerialization)
IList<Newtonsoft.Json.Serialization.JsonProperty> list = base.CreateProperties(type, memberSerialization);
foreach (Newtonsoft.Json.Serialization.JsonProperty prop in list)
{ sNomPropriete = prop.UnderlyingName;
Console.WriteLine("\t PropertyName = {0}", prop.PropertyName);
if (sNomPropriete.StartsWith("form_field:")) {
string[] sForm = sNomPropriete.Split(":");
prop.PropertyName = sForm [0];
iQuestionnaire = Int32.Parse(sForm [1]);
Console.WriteLine("\t PropertyName = {0}, iQuestionnaire = {1}", prop.PropertyName, iQuestionnaire);
public static void Main()
""form_submission_id"": 27469691,
""datetime"": ""02\/05\/2021 10:06"",
""deployment_name"": ""Email nouvelle App"",
""campaign_name"": ""Nouvelle App"",
""object_name"": ""Clients drive 01\/21"",
""form_field:983814"": [""5""],
""form_field:983817"": [""Suivant""],
""form_field:983832"": [""3""],
""form_field:983835"": [""3""],
""form_field:983838"": [""3""],
""form_field:983841"": null,
""form_field:983844"": [""Suivant""],
""form_field:989421"": [""4""],
""form_field:983856"": [""Suivant""],
""form_field:983859"": [""Des raccourcis en bas de l'\u00e9cran"", ""Une mise en avant des promotions du moment"", ""Les actualit\u00e9s de votre Drive""],
""form_field:983862"": [""Suivant""],
""form_field:983871"": [""3""],
""form_field:983874"": [""Suivant""],
""form_field:983883"": [""3""],
""form_field:983886"": [""Suivant""],
""form_field:983919"": [""3""],
""form_field:983922"": [""3""],
""form_field:983928"": [""2""],
""form_field:984810"": [""Souvent des produits indisponible - 2 fois la m\u00eame demande faites par mail, et jamais de r\u00e9ponse sur un probl\u00e8me de remboursement""],
""form_field:983931"": [""Terminer""],
""form_field:989415"": null,
""form_field:989418"": null,
""form_field:989951"": null,
""variable:centrale"": ""SCASO"",
""variable:nom_du_drive"": ""Libourne"",
""variable:service"": ""1"",
""variable:classe_age"": ""4"",
""variable:id_anonyme"": ""700333312"",
""variable:segment_client"": ""20007"",
""variable:ancienne_appli"": ""2"",
""variable:service_marque"": ""DRIVE"",
""variable:service_texte"": ""drive"",
""variable:service_sat_retrait"": ""le retrait de votre commande au drive"",
""form_submission_tag"": [],
""answer_url"": ""https:\/\/room.myfeelback.com\/feedbackviewer\/pq8n13_IPlBaht0Rz4yA1eGMBbQAGSjhC1yKdCySzGYgbSvYL2vn3ppUrSdasq1A=""
""form_submission_id"": 27469725,
""datetime"": ""02\/05\/2021 10:06"",
""deployment_name"": ""Email nouvelle App"",
""campaign_name"": ""Nouvelle App"",
""object_name"": ""Clients drive 01\/21"",
""form_field:983814"": [""7""],
""form_field:983817"": [""Suivant""],
""form_field:983832"": [""3""],
""form_field:983835"": [""3""],
""form_field:983838"": [""4""],
""form_field:983841"": null,
""form_field:983844"": [""Suivant""],
""form_field:989421"": [""4""],
""form_field:983856"": [""Suivant""],
""form_field:983859"": [""Des raccourcis en bas de l'\u00e9cran"", ""Une mise en avant des promotions du moment"", ""Les actualit\u00e9s de votre Drive""],
""form_field:983862"": [""Suivant""],
""form_field:983871"": [""4""],
""form_field:983874"": [""Suivant""],
""form_field:983883"": [""4""],
""form_field:983886"": [""Suivant""],
""form_field:983919"": [""3""],
""form_field:983922"": [""2""],
""form_field:983928"": [""4""],
""form_field:984810"": [""""],
""form_field:983931"": [""Terminer""],
""form_field:989415"": null,
""form_field:989418"": null,
""form_field:989951"": null,
""variable:centrale"": ""SCACHAP"",
""variable:nom_du_drive"": ""Niort Mend\u00e8s France"",
""variable:service"": ""1"",
""variable:classe_age"": ""4"",
""variable:id_anonyme"": ""100091734"",
""variable:segment_client"": ""20009"",
""variable:ancienne_appli"": ""2"",
""variable:service_marque"": ""DRIVE"",
""variable:service_texte"": ""drive"",
""variable:service_sat_retrait"": ""le retrait de votre commande au drive"",
""form_submission_tag"": [],
""answer_url"": ""https:\/\/room.myfeelback.com\/feedbackviewer\/36n0pEd0OHqqUs1VB2LKTx3YCNwAGSjhC1imZCySzGYgbSvYL2vn3ppUrSdasr1w=""
string sXSD = @"<?xml version=""1.0"" encoding=""utf-8""?>
<xs:schema elementFormDefault=""qualified"" xmlns:xs=""http://www.w3.org/2001/XMLSchema"">
<xs:element name=""Root"" nillable=""true"" type=""clsWrapper"" />
<xs:complexType name=""clsWrapper"">
<xs:element minOccurs=""0"" maxOccurs=""unbounded"" name=""notice"" type=""clsNotice"" />
<xs:complexType name=""clsNotice"">
<xs:element minOccurs=""0"" maxOccurs=""1"" name=""prix"" type=""clsPrix"" />
<xs:complexType name=""clsPrix"">
<xs:element minOccurs=""0"" maxOccurs=""unbounded"" name=""taxe"" type=""clsTaxe"" />
<xs:attribute name=""devise"" type=""xs:string"" />
<xs:attribute name=""montantTTC"" type=""xs:double"" use=""required"" />
<xs:complexType name=""clsTaxe"">
<xs:attribute name=""taxeId"" type=""xs:string"" />
<xs:attribute name=""montantHorsTaxe"" type=""xs:double"" />
<xs:attribute name=""tauxTVA"" type=""xs:double"" use=""required"" />
Console.WriteLine("Hello World");
var objWrapper = Deserialize<clsWrapper>(sJson, true);
foreach(clsCollection c in objWrapper.collection)
Console.WriteLine("## form_submission_id = {0}", c.form_submission_id);
foreach(var k in c.dicForm_field) {
Console.WriteLine("\t key = {0}", k);
[System.Xml.Serialization.XmlAttribute("taxeId")]
private Double? _montantHorsTaxe;
[System.Xml.Serialization.XmlAttribute("montantHorsTaxe")]
public Double montantHorsTaxe {
return _montantHorsTaxe.HasValue ? _montantHorsTaxe.Value : 0;
_montantHorsTaxe = value;
public bool montantHorsTaxeSpecified { get { return _montantHorsTaxe.HasValue; } }
[System.Xml.Serialization.XmlAttribute("horsTaxe")]
[System.Xml.Serialization.XmlAttribute("tauxTVA")]
public class clsCollection
[System.Xml.Serialization.XmlAttribute("form_submission_id")]
public int form_submission_id;
public Dictionary<string, Newtonsoft.Json.Linq.JToken> dicForm_field;
[XmlRoot(ElementName = "root")]
[System.Xml.Serialization.XmlElement("collection")]
public List<clsCollection> collection;