C# JSON.Net Serialize Dictonnary issues with decode in PHP -
i looking way this
{ "parameters": { "object1": { "propertie1": "value", "propertie2": "value" }, "object2": { "propertie1": "value", "propertie2": "value" } } }
c# got object this
public class myobject { public dictionnary<string, list < keyvaluepai < string, object > > > parameters = new dictionnary<string, list < keyvaluepai < string, object > > >(); }
i add data in dictionnary :
myobject.addparameters("object1", new list < keyvaluepair < string, object > > { new keyvaluepair < string, object >("propertie1", "value"), new keyvaluepair < string, object >("propertie2", "value"), } myobject.addparameters("object2", new list < keyvaluepair < string, object > > { new keyvaluepair < string, object >("propertie1", "value"), new keyvaluepair < string, object >("propertie2", "value"), }
put when decode serialized object in php got :
{ "parameters": { "object1": [ { "key": "propertie1", "value": "value" }, { "key": "propertie2", "value": "value" } ], "object2": [ { "key": "propertie1", "value": "value" }, { "key": "propertie2", "value": "value" } ] }, }
how can correct format json.net serialization?
you'll need add data in c# in form want.
the way add data now, indeed convert output.
you'll need in c#:
myobject.addparameters("object1", new list < keyvaluepair < string, object > > { new keyvaluepair < string, object >("propertie1", "value"), new keyvaluepair < string, object >("propertie2", "value"), } myobject.addparameters("object2", new list < keyvaluepair < string, object > > { new keyvaluepair < string, object >("propertie1", "value"), new keyvaluepair < string, object >("propertie2", "value"), }
Comments
Post a Comment