Skip to content

Conversation

yixiaojichunqiu
Copy link

later code,when i use public static func toJSONString(_ JSONObject: Any, prettyPrint: Bool) -> String? very inconvenient. Mapper use generic and these func will happen Generic parameter 'N' could not be inferred.I think these static func not in Mapper will be better.

public static func toJSONString(_ JSONObject: Any, prettyPrint: Bool) -> String? {
let options: JSONSerialization.WritingOptions = prettyPrint ? .prettyPrinted : []
if let JSON = MapperParse.toJSONData(JSONObject, options: options) {
return String(data: JSON, encoding: String.Encoding.utf8)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pass just .utf8 instead of String.Encoding.utf8

return String(data: JSON, encoding: .utf8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants