I like JSON a lot when it comes to seralizing data and REST web services. Perl has very good support for JSON and several libraries to pick from. While selecting the best components for my projects, I have been testing and timing a few Perl modules that produce JSON. These are JSON::PP, which has been in the Perl core since 5.13.9, Mojo::JSON, part of the excellent Mojolicious web framework, JSON::Tiny, a stand-alone adaptation of the latter, JSON::XS, written in C for blazing speed and Cpanel::JSON::XS, a fork of the latter. I also tested JSON:DWIW, an older module also written in C. Let’s see how they perform.
If you don’t want to bother, JSON::MaybeXS is a wrapper module that automatically selects the best out of three of them and can also operate like the core JSON, so you only have to change your use statement and leave the rest of your code untouched. JSON::PP, JSON:DWIW and the XS modules are packed with features, while Mojo::JSON and JSON::Tiny are minimalistic libraries and only produce inline compacted JSON suitable for machine consumption.