convert 'gateways' to JSON