khrt / Raisin

Raisin - a REST API micro framework for Perl 🐫 🐪
61 stars 30 forks source link

access to json serializer? #24

Closed pryankster closed 7 years ago

pryankster commented 7 years ago

This might not be a bug, there doesn't seem to be a way to access the json serializer to configure it (for example, to enable convert_blessed()

khrt commented 7 years ago

I'm already working on a brand new formatting modules for the framework, so in the nearest future it will be fixed.

pryankster commented 7 years ago

That would be awesome, but any suggestions for the most Raisin friendly way to output blessed objects now?

khrt commented 7 years ago

Unfortunately I can recommend only to override Raisin::Plugin::Format::JSON::serialize.

khrt commented 7 years ago

You can register your own serializer, please check following links: https://metacpan.org/pod/release/RTKH/Raisin-0.70/lib/Raisin.pm#register_encoder https://metacpan.org/source/RTKH/Raisin-0.70/lib/Raisin/Encoder/JSON.pm