Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

I stuck on the serialization of the Json Array in C# class.

I have json array. value is comming from API in cammalcase later. When I De-serialized that json array in c# class then value is also deserilaizing in camelCase. But i want that value in PascalCase after serializing the Json Array.

Some code below.

Json Array.

{"valid":"true","value":15311,"name":"Flipside Burger","expiry":false,"error":[{"code":"0004","msg":"your using a wild card as your IP limitation, this is not secure. Please provide your IP addresses to our support !","type":"warning"}],"token":"552e4a11aa6b10b823adf2dcdf857ae9"}


c# classes


XML
[DataMember]
      
   
   
    
      [DataMember]
      public CookieContainer valid { get; set; }

     
 

      [DataMember]
      public string ConversionToID { get; set; }

   
      [DataMember]
      public string conversionFromID { get; set; }

      [DataMember]
      public string errorType { get; set; }


    
      [DataMember]
      public string mode { get; set; }

      [DataMember]
      public string message { get; set; }

      
      [DataMember]
      public string stepTo { get; set; }

     
      [DataMember]
      public string step_valueTo { get; set; }

But I need Data in 



      [DataMember]
      public string Mode { get; set; }

      [DataMember]
      public string Message { get; set; }

      
      [DataMember]
      public string StepTo { get; set; }

     
      [DataMember]
      public string Step_valueTo { get; set; }


any comment would be appreciable.

Thanks and regard.
Vikash
Posted
Comments
Sergey Alexandrovich Kryukov 11-Jun-15 14:31pm    
Not clear. If you do both serialization and deserialization using Data Contract only, on the same data contract set of data types, this is one thing. If you are doing something else, it's a different thing. If you use Data Contract, you don't even need to look at JSON detail; everything is done transparently to you.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900