EWSoftware / PDI

A Personal Data Interchange (PDI) library that implements the vCard (RFC 2426), vCalendar, and iCalendar (RFC 2445) specifications including recurrence pattern generation
Microsoft Public License
65 stars 26 forks source link

Json serialization #19

Open nhaberl opened 3 years ago

nhaberl commented 3 years ago

Is there a way to serialize a Reccurence pattern into Json ? Reason is that I want to serialize it to a UI and therefore it would be great to expose as json so I can bind directly into any view model. Additionally it would be a bit more descriptive when passing between borders :)

What do you think ?

EWSoftware commented 3 years ago

There's nothing in the iCalendar specifications regarding JSON so I've never addressed it. I don't see any reason it couldn't be serialized to JSON but it would specific to this project. I don't use JSON much and only have a passing familiarity with how things can be structured so I'm not the best one to implement it. Given the properties I'm not sure how you'd be able to serialize them in such as way as to be useful for binding.

nhaberl commented 3 years ago

The use case would be a schedule interface like you have in Microsoft Outlook. So it would be of benefit to have a native way (from your library) to at least serialize tze helper methods like Weekly, Monthly and son on which are implememted in Reccurence class.

So we cold save the ical string and backbparsing it to a json which handles the web UI .

I have done this by abstracting Reccurence class but had to look in source to get the right integers e.g. when using DayOccurence.

So I thought would be great having rhis native from the llibrary anyhow.