how to create a dictionary
var populatedDictionary = ["key1": "value1", "key2": "value2"]
this is how to create an array
var shoppingList: [String] = ["Eggs", "Milk"]
you can create a dictionary of this type
var dictionary = [Int:String]() dictionary.updateValue(value: "Hola", forKey: 1) dictionary.updateValue(value: "Hello", forKey: 2) dictionary.updateValue(value: "Aloha", forKey: 3)
// anatron example
var dict = [ 1 : "abc", 2 : "cde"] dict.updateValue("efg", forKey: 3) print(dict)
your json
let dic :[String:Any] = ["name": "switch 1", "type": "Switch", "gatewayId":515, "serialKey": "98:07:2D:48:D3:56", "noOfGangs": 4, "equipments": [ [ "name": "light", "type": "Light", "port": "1" ], [ "name": "television", "type": "Television", "port": "3" ] ] ]
source share