How to get Json string from dictionary in swift 5

func getStringFromDictionary(_ dict:AnyObject) -> String{
	var strJson = ""
	do {
		let data = try JSONSerialization.data(withJSONObject: dict, options: JSONSerialization.WritingOptions.prettyPrinted)
		strJson = String(data: data, encoding: String.Encoding.utf8)!
	} catch let error as NSError {
		print("json error: \(error.localizedDescription)")
	}

	return strJson
}