Dictionary
struct Dictionary<Key, Value> : Collection, ExpressibleByDictionaryLiteral where Key : Hashable
-
Mechanica
Returns a Dictionary from a given JSON String.
Declaration
Swift
public init?(json: String)
-
Mechanica
Returns a JSON Data from dictionary.
Declaration
Swift
public func jsonData(prettify: Bool = false) -> Data?
Parameters
prettify
to prettify data (default is ).
Return Value
optional JSON Data.
-
Mechanica
Returns a JSON String from dictionary.
Declaration
Swift
public func jsonString(prettify: Bool = false) -> String?
Parameters
prettify
to prettify string (default is ).
Return Value
optional JSON String.
-
Mechanica
Lowercase all keys in dictionary.
Declaration
Swift
public mutating func lowercaseAllKeys()
-
Mechanica
Returns true if the
key
exists in the dictionary.Declaration
Swift
public func hasKey(_ key: Key) -> Bool