How do I pretty-print data for debugging using Property Lists with Swift?

Swift, Pretty Print, Data, Debugging, Property Lists
This guide explains how to pretty-print data for debugging using Property Lists in Swift, which helps to visualize data structures clearly.
// Example code in Swift to pretty-print a dictionary import Foundation let sampleData: [String: Any] = [ "name": "John Doe", "age": 30, "isEmployee": true, "department": ["HR", "Finance", "Marketing"] ] if let jsonData = try? JSONSerialization.data(withJSONObject: sampleData, options: .prettyPrinted) { if let jsonString = String(data: jsonData, encoding: .utf8) { print(jsonString) } }

Swift Pretty Print Data Debugging Property Lists