Try:
[return: JSONReturnBinder(Properties="PostCode,Street")]
public Address GetAddress()
{
....
return myAddress;
}
This should tell the framework to only serialize PostCode and Street
properties from the Address class.
On Sep 1, 6:40 pm, bdaniel7 <[email protected]> wrote:
> Yes, that did it, however it serialized also some inherited properties
> like ValidationErrorMessages.
> So, to avoid the extra bytes, i'll use a dto and bring to display only
> the properties needed for display.
>
> On Sep 1, 9:16 am, John Simons <[email protected]> wrote:
>
> > You should be able to json Address.
> > Have you tried (Properties="Address"), the Properties only accepts the
> > Property Name, it doesn't accept the dot notation.
> > If you want to send back as json only the address than have you tried
> > something like:
> > [return: JSONReturnBinder]
> > public Address GetAddress()
> > {
> > ....
> > return myAddress;
> > }
>
> > On Sep 1, 3:38 pm, bdaniel7 <[email protected]> wrote:
>
> > > well, no;
> > > all examples of using JSONReturnBinder that i saw, didn't say that i
> > > have to use DataMember and DataContract
> > > and they worked.
>
> > > On Aug 31, 8:57 pm, Gabriel Mancini de Campos
>
> > > <[email protected]> wrote:
> > > > hi can you put sample code where ??
>
> > > > and your property have [DataMember] attribute and your class
> > > > [DataContract]?
>
> > > > On 31 ago, 11:58, bdaniel7 <[email protected]> wrote:
>
> > > > > Hello,
>
> > > > > I have this situationhttp://dblendea.pastebin.com/f4b2e26a3
>
> > > > > is it possible to serialize incident.Address.Street and Postcode with
> > > > > JSONReturnBinder?
>
> > > > > i tried with JSONReturnBinder
> > > > > (Properties="Address.Street,Address.Postcode") but no luck.
> > > > > i get an exception:
>
> > > > > Message: Failed to JSON serialize object. Property Address.Street
> > > > > could not be found for type Incident.
>
> > > > > Thanks,
> > > > > Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---