Skip to content

Amirgg/JSON-Pretty-Print-Extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

JSON-Pretty-Print-Extension

A Swift extention to pretty print the JSON string

This extention returns a NSMutableAttributedString

How to use:

1-Add JSON-Pretty-Print-Extension.swift file to your project

2-Set your view's .attributedText to YourString.prettyPrintJSON()

Example:

var jsonString = "{\"Sample\":\"Json\"}"
myLable.attributedText = jsonString.prettyPrintJSON()

Customize:

Edit Key and Value Color and Level Space

//key color : UIColor 
//value color : UIColor
//level space : Int
var jsonString = "{\"Sample\":\"Json\"}"
myLable.attributedText = jsonString.prettyPrintJSON(.red, .blue, 6)

About

A Swift extention to pretty print the JSON string

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages