Refactored ticket json generation