tl24 / jsonexserializer

Automatically exported from code.google.com/p/jsonexserializer
1 stars 1 forks source link

serialize read-only properties as well #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
it would be very convenient to serialize the properties even if they are read-
only (don't provide a set).

Cheers,
Sylvain

Original issue reported on code.google.com by sylvain....@gmail.com on 17 Jul 2009 at 12:14

GoogleCodeExporter commented 9 years ago
You just need to add the JsonExProperty attribute to it:

public class Foo {

  [JsonExProperty]
  public int ID {
    get { return _id; }
  }
}

Original comment by elliott....@gmail.com on 17 Jul 2009 at 1:16

GoogleCodeExporter commented 9 years ago
cool it works well

is there a reason why it is not done by default?

Original comment by sylvain....@gmail.com on 17 Jul 2009 at 2:17

GoogleCodeExporter commented 9 years ago
Yes, because you wouldn't be able to deserialize it without changing some 
settings, so 
I wanted it to be an explicit choice to do so.

Original comment by elliott....@gmail.com on 17 Jul 2009 at 2:59

GoogleCodeExporter commented 9 years ago
ok, I understand, it completely makes sense.

(I never user the deserialization :-) )

Original comment by sylvain....@gmail.com on 17 Jul 2009 at 3:12

GoogleCodeExporter commented 9 years ago
Issue 60 has been merged into this issue.

Original comment by elliott....@gmail.com on 19 Jul 2011 at 11:18