How to print Json Data with Format in Console

Ekramul Hoque
Daily iOS
Published in
1 min readNov 22, 2018

When we work encode json and encoder that time we need to output as prettyPrinted so how can we do this !

let jsonEncoder = JSONEncoder()

jsonEncoder.outputFormatting = .prettyPrinted
let jsonObject = try? jsonEncoder.encode(carObj)

Thanks ! 😝

--

--