factor service detail json creation into a func for testing