1

Closed

Serialization of inherited class

description

Hello
 
I have a class which inherits from another class and then changes the parameter of one of the inherited variables. Eg.
 
class A
{
int no;
}
 
class B: A
{
bool no;
}
 
Now, I create an object of B and serialize it by "JsonConvert.SerializeObject(b)", on doing this I am getting an error:
 
A member with the name 'b' already exists on 'Sample.B'. Use the JsonPropertyAttribute to specify another name.
 
What to do?
Closed Jan 16, 2012 at 6:58 AM by JamesNK
Fixed

comments

dabuddhaman wrote Dec 23, 2011 at 8:22 PM

Use the JsonPropertyAttribute to specify another name.

akshayakrsh wrote Dec 24, 2011 at 11:59 AM

Cant do it, the JSON is used cross platform in different codes n platforms! Any other solution?

akshayakrsh wrote Jan 16, 2012 at 7:55 AM

@JamesNK

Can I install this new version using NuGet? Or will I have to wait for the next release?