Skip to content

Instantly share code, notes, and snippets.

@3lvis
Last active September 25, 2022 17:58
Show Gist options
  • Select an option

  • Save 3lvis/af15c688c1b9aac386fcfabdaad4350d to your computer and use it in GitHub Desktop.

Select an option

Save 3lvis/af15c688c1b9aac386fcfabdaad4350d to your computer and use it in GitHub Desktop.
JSON Pretty Print Swift 5
print(String(data: try! JSONSerialization.data(withJSONObject: dict, options: .prettyPrinted), encoding: .utf8)!)
@gongzhang
Copy link
Copy Markdown

let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted

@3lvis
Copy link
Copy Markdown
Author

3lvis commented Sep 24, 2020

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment