In my custom widget I have created and gotten a hold of a reference to an Event object. My question is how can I marshall this to object into a JSON object. Is there something built in for this, or do I need to create my own marshaller of sorts with Velocity code?
And what about other object types (Thread, Wiki Page, etc.)?
And, if I needed to roll my own, are there any utilities in the widget API to properly escape string values as JSON?
There is not a built-in object-to-JSON serializer, instead, format the object using Velocity:
This allows you to include only the data you care about.