Use the JsonEncoder for Rest routes.