Serialising objects like REST2

I’m writing an internal-use extension that needs to serialise tickets and transactions as JSON to send them to an external service. Rather than re-invent the wheel I thought I might be able to reuse some of the REST2 machinery to do this, without having to make an actual HTTP/REST request, but I can’t see how. Would this be possible at all?

I know most records have a Serialize method through RT::Record which I would intend to use if I can’t just get the same information from REST2, but I’d be re-implementing things already in there.

I eventually found RT::REST2::Util::serialize_record which does pretty much exactly what I want. By itself it’s missing the _hyperlinks field and “extra fields” functionality, but it looks like I can transplant what I need from RT::REST2::Resource::Record::Readable::serialize and RT::REST2::Resource::Record::Hypermedia as necessary.