move from legacy compat JSON to_json to modern JSON::XS encode_json, RT#22630