Skip to content

Instantly share code, notes, and snippets.

@anatoliykant
Created September 14, 2021 19:57
Show Gist options
  • Save anatoliykant/6322689065beec7a302f6b1bd6640303 to your computer and use it in GitHub Desktop.
Save anatoliykant/6322689065beec7a302f6b1bd6640303 to your computer and use it in GitHub Desktop.
do {
let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted
let data = try encoder.encode(sampleInput)
if let jsonString = String(data: data, encoding: .utf8) {
print(jsonString)
}
} catch {
print(error)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment