I've got a fairly complex object, and I want to send "select"
information from an array of them to JSON. But I can't get it to
serialize properly.
class Ticket
{
public ScheduledInstall TimeOfInstall{get;set;}
public ContactInfo UserInformation{get;set}
}
class ScheduledInstall
{
public Ticket Ticket{get;set;}
public DateTime InstallDate{get;set;}
}
class Technician
{
public IList<ScheduledInstall> Schedule{get;set;}
}
All's working with ActiveRecord in the database, but when I try to
serialize it using JSONReturnBinder it hangs (probably because of the
recursion). I put a [JsonIgnore] attribute on the Ticket property of
the scheduledinstall, but that doesn't seem to work.
For this particular instance, I really just want an array of DateTimes
and ContactInfo.Addresses. So I tried using the following on my
returnbinder:
[return: JSONReturnBinder(Properties =
"JobType,Ticket.ContactInfo.Address")]
But that won't work either -- JSONReturnBinder doesn't seem to be able
to go deep into Properties like that.
Will I have to just create a new struct and loop through all the
scheduledinstalls for the technician like so:
struct CalendarView
{
DateTime dateOfInstall;
string Address;
}
foreach(var install in thisTech.Schedule)
{
var calendarItem = new CalendarView{...}
//Add to my return array
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---