Click here to Skip to main content
15,885,978 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using

[System.Xml.Serialization.XmlArrayItem(typeof(DTContractTaxBreakdown))]
on a property

C#
public ArrayList TaxBreakdown
       {
           get
           {
               return _taxBreakdown;
           }
           set
           {
               _taxBreakdown = value;
           }
       }


its working fine in binary serialization but in case of JSON serialization its not working.

I wants to serialize these object into JSON without changing type of property.
Equivqlent of [System.Xml.Serialization.XmlArrayItem(typeof(DTContractTaxBreakdown))]
in JSON.
i am using newtonsoft.json with c#

Thanks in advance !!!
Posted

1 solution

First of all, avoid using ArrayList in new code by all means. This class was rendered obsolete as early as of .NET v.2.0, when generics were introduced. Use generic collections, including System.Collections.Generic.List<>.

Please see my past answers on JSON:
haw to get data from Cloudant (json document)[^],
how to conver multi level json data to C# Object?[^],
How To Convert object type to C# class object type[^],
deseralize a json string array[^].

—SA
 
Share this answer
 

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