Closed GoogleCodeExporter closed 9 years ago
Properties are expected to have a Getter and a Setter in order to be serialized
otherwise deserialization will fail. The "A" property on header has no setter
so its
not serialized. You can add the "JsonExProperty" attribute to the property to
force
it to serialize.
Example:
public class Hdr {
[JsonExProperty]
public string A {get { return "A"; }}
}
How are you using this? Are you doing only serialization, sending to a browser
perhaps?
Original comment by elliott....@gmail.com
on 22 Jun 2008 at 1:05
thank you very much for this information.
(I would add this to the quickstat wiki page).
> How are you using this? Are you doing only serialization, sending to a
browser
perhaps?
That's right, some data is read only so object designed accordingly.
Original comment by Afro.Sys...@gmail.com
on 22 Jun 2008 at 3:37
yet,
if the property is primitive (such as int) it fails @
metadata.proprtyhandler.validate.
any suggest how to hack this design?
Original comment by Afro.Sys...@gmail.com
on 22 Jun 2008 at 9:29
I could probably remove that validation. In the meantime you might be able to
get
away with declaring a private or internal setter, although I'm not totally sure
that
it still won't flag it as not being writable. Example:
public class Hdr {
[JsonExProperty]
public string A {
get { return "A"; }
private set { ; }
}
}
Original comment by elliott....@gmail.com
on 23 Jun 2008 at 1:55
I set this (empty) private setter and it works!
thanks for writing this efficient library for us ---
Original comment by Afro.Sys...@gmail.com
on 24 Jun 2008 at 7:54
The validation to check for the property to be writable when using the
JsonExProperty
attribute has been removed.
Original comment by elliott....@gmail.com
on 2 Jul 2008 at 10:19
Original comment by elliott....@gmail.com
on 2 Jul 2008 at 10:21
Original comment by elliott....@gmail.com
on 10 Jul 2008 at 5:02
Original issue reported on code.google.com by
Afro.Sys...@gmail.com
on 12 Jun 2008 at 5:43