Debug and complete a partially implemented class that parses JSON-format records (loan id, ticket id, status) and determines, from tickets and their statuses, whether something is fraudulent; implement missing methods and fix broken logic such as sorting by a specific field.
Asked in the technical screen stage. Existing code has missing pieces and broken logic, and must produce the expected output.
Implement detect_fraudulent_loans(records). records is a list of JSON strings, each containing loan_id, ticket_id, and status. A loan is fraudulent if any associated ticket has status "fraudulent". Return a list of objects with loan_id and boolean fraudulent, sorted lexicographically by loan_id.
Example: ['{"loan_id":"L2","ticket_id":"T1","status":"clear"}', '{"loan_id":"L1","ticket_id":"T2","status":"fraudulent"}'] returns [{'loan_id':'L1','fraudulent':True},{'loan_id':'L2','fraudulent':False}].
def detect_fraudulent_loans(records):