Use encode_json instead of to_json:

to_json is not provided by JSON::MaybeXS. We use encode_json instead.

This fixes a breakage that was presented by the rev_deps.pl example.